Hi,
Where im making mistake in msaccess query that getting syntax error.
SELECT pd.*,p.po_no,p.po_date,s.sub_desc from(pod) pd INNER JOIN poh p ON pd.po_no = p.po_no INNER JOIN (subledg) s ON p.supp_code = s.acc_code WHERE pd.itemcode IN (Select itemcode FROM(pod) WHERE(po_no = 226566)) ORDER BY pd.itemcode
Thanks & Regards,
Looks like it's ok, I think it's this part what is causing the error:
from(pod) pd
it should be:
from pod pd
Formatting your query is important at it's easier to read, easier to understand and your making less mistakes. I would recommand to not use pd.* as well, use only the fields you need and if you really need them all then specify them all.
SELECT
pd.*,
p.po_no,
p.po_date,
s.sub_desc
FROM pod pd
INNER JOIN poh p
ON pd.po_no = p.po_no
INNER JOIN subledg s
ON p.supp_code = s.acc_code
WHERE pd.itemcode IN (
SELECT
itemcode
FROM pod
WHERE po_no = 226566
)
ORDER BY pd.itemcode;
Although this is the correct syntax for SQL, it might not be for Access queries. The Access SQL dialect differs on several spots from T-SQL. I believe to remember joins are constructed in a different way