PDA

View Full Version : School Help: DB Access question.


jOeHaCk98
02-28-2006, 07:41 PM
These are the fields:
Firstname, Lastname, Order Date, Product name, Quantity, Unit Price, OrderID

Here is the problem
I want to total up the customer orders, right now it is displaying each individual order. I want to delete the duplicate 'OrderID' BUT merge the 'Unit Price' THEN multiply by the 'Quantity'

Can anyone help?

THANKS!

jOeHaCk98
03-01-2006, 12:49 PM
nobody? help a brotha out. promote education. :)

240meowth
03-03-2006, 02:00 AM
i'd love to help, but i forgot all my SQL's...

although i can recommand a site to you, http://www.w3schools.com/ this thing helped me through college.

jOeHaCk98
03-03-2006, 08:53 AM
cool thanks.
Why did you lose all ur sql? What are you doing know, if you dont mind me asking.

ZK
03-03-2006, 10:54 AM
These are the fields:
Firstname, Lastname, Order Date, Product name, Quantity, Unit Price, OrderID

Here is the problem
I want to total up the customer orders, right now it is displaying each individual order. I want to delete the duplicate 'OrderID' BUT merge the 'Unit Price' THEN multiply by the 'Quantity'

Can anyone help?

THANKS!

Use this:

Select distinct Firstname, Lastname, Order Date, sum(unit price*quantity) group by firstname, lastname, Order Date

I feel old .. I graduated from college 6 years ago.

jOeHaCk98
03-03-2006, 11:41 AM
I guess feeling old cant feel too bad since you went from a 240sx to an evo. You finacial situation appears to be better.

ZK
03-03-2006, 11:53 AM
I guess feeling old cant feel too bad since you went from a 240sx to an evo. You finacial situation appears to be better.

Perhaps.. but the S13 cost me 20K over 3 years to build and was breaking something every other month so this car is actually about the same if you add it up. Plus I wanted to spend more time actually driving than fixing broken stuff.

You may think if you make more money you have more of it but in the end, it will get spent somewhere, somehow and all sorts of expenses you didn't predict will come out to fill it up so in the end you're about the same.

As for SQL, I use it everyday so if you have any other questions let me know.

jOeHaCk98
03-03-2006, 12:16 PM
Thanks for offer. I probably will from time to time.

jOeHaCk98
03-07-2006, 01:09 AM
in regards to the same question. My sql is:

SELECT Orders.OrderID, Customers.LastName, Orders.OrderDate, Products.ProductID, Products.ProductName, [Order Details].Quantity, Products.UnitPrice, [UnitPrice]*[Quantity] AS Amount
FROM Products INNER JOIN ((Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID) INNER JOIN [Order Details] ON Orders.OrderID = [Order Details].OrderID) ON Products.ProductID = [Order Details].ProductID;


My instructions are to:

Create a query called Total Sales by Order, where you display total sales for each order id.