I would first try refactoring your SQL to use INNER JOIN statements
instead of the comma separated lists you are currently using. I would also
not use any subqueries. Test this and see if it works for you:
SELECT SUM(li.quantity) as qtysoldytd
FROM LineItem li
INNER JOIN Sales sa
on li
should be
directed toward getting the query running correctly, THEN worry about making
it go faster.
Rhino
- Original Message -
From: <[EMAIL PROTECTED]>
To:
Sent: Friday, November 04, 2005 12:28 AM
Subject: SQL help for qty Sold YTD...
> I cannot figure this one out. I have
I cannot figure this one out. I have a Category table with 50,000
records, an Inventory table with over 2 million records. A Sales table
with 500,000 records. And a LineItem table with 800,000 records pairing
the Inventory ID with the Sales Transaction ID and Quantity. I need to
generate a Quantity