Page 1 of 1

SQL Query Show Customers Orders, SUM for products

Posted: Thu Aug 13, 2009 6:49 am
by j.smith1981
Hi,

I have a problem I just cant seem to get my head around to create the SQL for.

Basically all I want is this:

A list of a users products ordered.

Showing each product individually.

Like so (excuse for the crude example but this is what I am essentially looking for:

Code: Select all

 
Username (of customer)  Customer Name   Order no        Vendor code Qty     Date Ordered
jsmith1981                    Jez                   1                  123              1       13/08/09
                                                         2                   124              2      13/08/09
                                                         2                   125              6      13/08/09
 
harry                           Harry               20                  120              7      08/08/09
                                                        20                  110             2       08/08/09
 
You can use the order id if required but at the very least this example must include listing the orders by username!

I did an example like this thats required at University but for the life of me cant remember how to do this.

Thanks for helping in advance,
Jeremy.