Problem 32 Write a query to display the first name, last name, street, city, state, and zip code of any customer who purchased a Foresters Best brand top coat between 2017-7-15, and 2017-7-31. If a customer purchased more than one such product, display the customer’s information only once in the output. Sort the output by state, last name, and then first name (Partial results shown in Figure P7.32). Figure 7.32 Figure P7.32
Select distinct LGCustomer.Cust_Fname, LGCustomer.Cust_Lname, LGCustomer.Cust_Street, LGCustomer.Cust_City, LGCustomer.Cust_State, LGCustomer.Cust_Zip from LGCustomer , LGInvoice, LGLine, LGProduct, LGBrand where LGCustomer.Cust_Code = LGInvoice.Cust_Code and LGInvoice.Inv_Num = LGLine.Inv_Num and LGLine.Prod_SKU = LGProduct.Prod_SKU and LGProduct.Brand_ID = LGBrand.Brand_ID and LGBrand.Brand_Name = "FORESTERS BEST" and LGProduct.Prod_Category = "Top Coat" and LGInvoice.Inv_Date between str_to_date('7/15/2015', '%d/%m/%y') and str_to_date('7/31/2015', '%d/%m/%y') order by LGCustomer.Cust_State, LGCustomer.Cust_Fname;
Do ask if any doubt. Please up-vote.
Get Answers For Free
Most questions answered within 1 hours.