Help with Query

A

Alan

I have the below query and I get the below error message. For the life of me
I can not figure it out. Any help would be greatly appreicated.

Query:
SELECT 810_HEADER.*, 810_DETAIL.*, 810_SAC.* FROM 810_HEADER INNER JOIN
810_DETAIL ON [810_HEADER].PONUM = [810_DETAIL].PONUM INNER JOIN 810_SAC ON
[810_HEADER].PONUM = [810_SAC].PONUM WHERE [810_HEADER].STATUS='1' AND
[810_DETAIL].QTYINVOICED>'0'

Error Message:
Syntax error (missing operator) in query expression '[810_HEADER].PONUM =
[810_DETAIL].PONUM INNER JOIN 810_SAC ON [810_HEADER].PONUM = [810_SAC]PONUM'.
 
K

Ken Sheridan

You need to parenthesise the first JOIN:

SELECT 810_HEADER.*, 810_DETAIL.*, 810_SAC.*
FROM (810_HEADER INNER JOIN 810_DETAIL
ON [810_HEADER].PONUM = [810_DETAIL].PONUM)
INNER JOIN 810_SAC ON [810_HEADER].PONUM = [810_SAC].PONUM
WHERE [810_HEADER].STATUS='1'
AND [810_DETAIL].QTYINVOICED>'0';

I see you've delimited the Status and QtyInvoiced values with quotes. Are
they really text data types?

Ken Sheridan
Stafford, England
 
A

Alan

Thanks Ken, that worked. Yes unfortunatly the Status and QTYINOVICED are
text fields. Thank you very much for the hlep.

Ken Sheridan said:
You need to parenthesise the first JOIN:

SELECT 810_HEADER.*, 810_DETAIL.*, 810_SAC.*
FROM (810_HEADER INNER JOIN 810_DETAIL
ON [810_HEADER].PONUM = [810_DETAIL].PONUM)
INNER JOIN 810_SAC ON [810_HEADER].PONUM = [810_SAC].PONUM
WHERE [810_HEADER].STATUS='1'
AND [810_DETAIL].QTYINVOICED>'0';

I see you've delimited the Status and QtyInvoiced values with quotes. Are
they really text data types?

Ken Sheridan
Stafford, England

Alan said:
I have the below query and I get the below error message. For the life of me
I can not figure it out. Any help would be greatly appreicated.

Query:
SELECT 810_HEADER.*, 810_DETAIL.*, 810_SAC.* FROM 810_HEADER INNER JOIN
810_DETAIL ON [810_HEADER].PONUM = [810_DETAIL].PONUM INNER JOIN 810_SAC ON
[810_HEADER].PONUM = [810_SAC].PONUM WHERE [810_HEADER].STATUS='1' AND
[810_DETAIL].QTYINVOICED>'0'

Error Message:
Syntax error (missing operator) in query expression '[810_HEADER].PONUM =
[810_DETAIL].PONUM INNER JOIN 810_SAC ON [810_HEADER].PONUM = [810_SAC]PONUM'.
 
Top