Something like:

Select ItemDesc, count(ItemDesc)
>From Orders o
        Inner join Order_Items oi on o.OrderID = oi.OrderID
        Inner join ItemDescrption id on oi.ItemID = id.ItemID
Where o.Date >= '2/28/2003' and o.Date < '2/29/2003'
Group by ItemDesc
Order by ItemDesc


-----Original Message-----
From: Dave and Cathy [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 26, 2003 08:13
To: SQL
Subject: getting results from 2 tables

Hi All,

    I have three SQL tables:
        Orders - contains Date, OrderID, 
        ItemDescription - contains ItemID and ItemDesc, 
        Order_Items - a table that links the two on OrderID and ItemID
(many-to-many).

    I need to produce a report of how many items are in today's Orders,
grouped by ItemDesc (with a count), in ItemDesc Order.

    Seems like a common-enough requirement, but I can't seem to find a
result other than doing one SELECT then looping thru the results with
another select.

    Is there a one-query solution please?

    TIA 
        Dave 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=6
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=6
Get the mailserver that powers this list at http://www.coolfusion.com

                        

Reply via email to