SuperComputing
IS-IT--Management
OK, I have a pretty extensive report pulling data from 3 different tables, and working perfectly. Now, of course, anytime management sees something good, they want to break it. The only solution that I can see would maybe be a Expression Field, but it's not recognizing any of my syntax.
Here's the scenario:
The report pulls Item Number, Description, Category, Cost, etc... perfectly with the following SQL Query: (I'll abbreviate some...)
SELECT "Items"."ItemNumber", "Items"."Description1", "Items"."Category", "Items"."Subcategory", "Items"."LastCost", "Items"."QtyOnHand", "Items"."QtyCommitted", "Items"."QtyOnBackord", "Items"."QtyOnOrder", "Items"."ActiveDiscontinued", "InventoryMonthly"."Location", "InventoryMonthly"."QtySold", "Forecast"."Current", "Forecast"."Revised", "InventoryMonthly"."YearId"
FROM {oj ("Items" "Items" LEFT OUTER JOIN "Forecast" "Forecast"
ON "Items"."ItemNumber"="Forecast"."ItemNumber")
INNER JOIN "InventoryMonthly" "InventoryMonthly" ON "Items"."ItemNumber"="InventoryMonthly"."ItemNumber"}
WHERE "InventoryMonthly"."Location"='WHS1'
Now, I have sperately developed the following SQL Query on 2 more tables that pulls the exact data I need:
SELECT SUM(PurchLine.QtyOrdered)
FROM PurchOrder
LEFT OUTER JOIN PurchLine
ON PurchLine.PoNumber = PurchOrder.PoNumber
WHERE PurchLine.ItemNumber = 'XXXXXX-XXXX'
So, my problem is, I can't make the report pull the seperate SQL query for each ItemNumber in the report that is already working. Whenever I use the database expert to link the ItemNumber fields together, the report will run forever, just hang up.
Do I have a join wrong? Can I do it through an Expression field? Any ideas on what direction to take?
Thanks in advance!
Here's the scenario:
The report pulls Item Number, Description, Category, Cost, etc... perfectly with the following SQL Query: (I'll abbreviate some...)
SELECT "Items"."ItemNumber", "Items"."Description1", "Items"."Category", "Items"."Subcategory", "Items"."LastCost", "Items"."QtyOnHand", "Items"."QtyCommitted", "Items"."QtyOnBackord", "Items"."QtyOnOrder", "Items"."ActiveDiscontinued", "InventoryMonthly"."Location", "InventoryMonthly"."QtySold", "Forecast"."Current", "Forecast"."Revised", "InventoryMonthly"."YearId"
FROM {oj ("Items" "Items" LEFT OUTER JOIN "Forecast" "Forecast"
ON "Items"."ItemNumber"="Forecast"."ItemNumber")
INNER JOIN "InventoryMonthly" "InventoryMonthly" ON "Items"."ItemNumber"="InventoryMonthly"."ItemNumber"}
WHERE "InventoryMonthly"."Location"='WHS1'
Now, I have sperately developed the following SQL Query on 2 more tables that pulls the exact data I need:
SELECT SUM(PurchLine.QtyOrdered)
FROM PurchOrder
LEFT OUTER JOIN PurchLine
ON PurchLine.PoNumber = PurchOrder.PoNumber
WHERE PurchLine.ItemNumber = 'XXXXXX-XXXX'
So, my problem is, I can't make the report pull the seperate SQL query for each ItemNumber in the report that is already working. Whenever I use the database expert to link the ItemNumber fields together, the report will run forever, just hang up.
Do I have a join wrong? Can I do it through an Expression field? Any ideas on what direction to take?
Thanks in advance!