I am stumped. Here is my query:SELECT o.OrderDate AS 'Order Date', od.OrderID AS 'Order #', od.ProductCode AS 'Item #', od.ProductName AS 'Description', od.Quantity, od.ProductPrice AS 'Item Price', o.TotalShippingCost AS 'Shipping//Handling', o.SalesTax1 AS 'Sales Tax', ((CAST(od.ProductPrice AS Float) * CAST(od.Quantity AS Integer)) + CAST(o.TotalShippingCost AS Float) + CAST(SalesTax1 AS Float))AS 'Net Sale'FROM Orders AS oINNER JOIN OrderDetails AS od ON o.OrderID = od.OrderIDWHERE PaymentDeclined IS NULLOrder by o.OrderDate DESC
Here is the Output:order date order # item # description quantity item price shipping//handling sales tax net sale5/4/2012 12:32 5742 096-050607 F2000C GFCI Pump 1 89.99 6.81 8.1 104.95/4/2012 12:38 5744 090-380006 Horizontal Beam for Metal Frame Round Pools 14' and up Part # 090-380006 5 9.99 5.99 0 55.945/4/2012 12:38 5744 097-080030 Pin with Grommet for Metal Frame Round Pools 14' and up. (10 Ea. per Bag) Part #: 097-080030 1 5.99 5.99 0 11.985/4/2012 12:38 5744 090-380056 T-Fitting for 18' X 48", 18' X 52" Metal Frame Round Pools part # 090-380056 5 7.99 5.99 0 45.945/4/2012 12:43 5745 078-110143 Pump Retaining Nut - Part #: 078-110143 1 2.99 5.99 0 8.985/4/2012 13:09 5751 090-010104 Hex Head Screws for all Metal Frame Round Pools.(12 EA.) Part #: 090-010104 1 1.99 5.99 0 7.985/4/2012 14:04 5752 078-110222 Strainer Basket for SFS 600/1000/1500 skimmer canisters. Part #: 078-110222 2 2.99 5.99 0 11.975/4/2012 14:10 5753 096-050610 F700C GFCI Pump 1 0 0 0 05/4/2012 14:10 5754 096-050609 F1000C GFCI Pump 2 39.99 8.62 5.4 945/4/2012 14:13 5755 078-110110 Pump Retaining Nut 078-110110 1 2.99 5.99 0 8.985/4/2012 14:15 5756 097-201201 Leg Cap for all Pro Series Metal Round Pools 22' and up. (*****5 Ea. per bag*****) Part #: 097-201201 5 5.99 5.99 0 35.945/4/2012 14:15 5756 090-380092-1 Horizontal Beam (Grey) for all Pro Series Round Frame Pools 22' and up Part # 090-380092-1 3 10.99 5.99 0 38.965/4/2012 14:15 5757 097-080002 Leg Cap for all Metal Frame Round Pools 14' and up. (5 Ea. per Bag) Part #: 097-080002 2 5.99 5.99 0 17.975/4/2012 14:17 5758 Account General Consumer Account 1 0 0 0 05/4/2012 14:18 5759 097-080002 Leg Cap for all Metal Frame Round Pools 14' and up. (5 Ea. per Bag) Part #: 097-080002 4 5.99 5.99 0 29.955/4/2012 14:24 5760 096-050620 SFS1000 Assembled Canister with Pump 1 49.99 7.9 0 57.895/4/2012 14:25 5761 096-050609 F1000C GFCI Pump 1 39.99 6.81 0 46.85/4/2012 14:28 5762 096-050609 F1000C GFCI Pump 1 39.99 6.81 2.7 49.55/4/2012 14:29 5763 096-050609 F1000C GFCI Pump 1 39.99 11.85 3.1 54.945/4/2012 14:29 5763 097-080030 Pin with Grommet for Metal Frame Round Pools 14' and up. (10 Ea. per Bag) Part #: 097-080030 1 5.99 11.85 3.1 20.94
What I want to accomplish is to make sure that duplicate order numbers multiply the item price and quantity, but only add the shipping and sales tax on the first order number (shipping and sales tax are the same on duplicate orders). I see it in my head but cannot figure it out. Any help or explanation would be greatly appreciated.