on 12/27/05 6:25 PM, Scott Haneda at [EMAIL PROTECTED] wrote:

> I have two tables, order and order items.  An order can have 1 or more order
> items.
> 
> Important data in order is the `id` which is the key to link that order to
> the order_items table.
> 
> Quantity of items is stored in the order_items table.
> 
> I need to select the below data, and would like to do it in one select, and
> not use server side code to add it all up:
> 
> Total Number of Orders (count order records)
> Total Products $ (sum of qty and price in order_items)
> Total Shipping $ (sum of shipping field in order record)
> Total Gift Card $ (sum of gift card price in order record)
> Total Tax $ (sum of sales tax in order record)
> Total Orders: $ (grand summary of total in order record)

Sorry for the noise, turns out I did not need this at all, and can just use
sum() and no need for the join at all.
-- 
-------------------------------------------------------------
Scott Haneda                                Tel: 415.898.2602
<http://www.newgeo.com>                     Novato, CA U.S.A.



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to