Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scalar Subquery

Status
Not open for further replies.
May 12, 2005
39
US
I'm running Pervasive 8.5 and I want to use a subquery as an item in the SELECT clause.

I have a view that relates Inventory to Jobs in Process so I can get the total WIP for a part and compare that to whats onhand. However I also need to compare this to a summary of Open order quantity, and shipped order qty last year so I'd like to create a SELECT statement as follows for a new View:

SELECT
INVENTORY_MSTR."PART",
INVENTORY_MSTR."QTY_ONHAND",
SUM(JOB_HEADER."QTY_ORDER"),
(
SELECT
SUM(ORDER_LINES."QTY_ORDERED")
FROM
"ORDER_LINES" ORDER_LINES
WHERE
ORDER_LINES."PART" = INVENTORY_MSTR."PART";
)
FROM
"INVENTORY_MSTR" INVENTORY_MSTR INNER JOIN "JOB_HEADER"
ON INVENTORY_MSTR."PART" = JOB_HEADER."PART"
WHERE
INVENTORY_MSTR."PRODUCT_LINE" >= 'A1' AND
INVENTORY_MSTR."PRODUCT_LINE" <= 'N1' AND
JOB_HEADER."AMT_MATERIAL" <> 0
GROUP BY
INVENTORY_MSTR."PART",
INVENTORY_MSTR."QTY_ONHAND";

Does Pervasive support scalar subqueries such as this one? I've been trying to create this but I keep getting syntax errors. And if this isn't supported does anyone else know a better way to gather the information i need?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top