Click here to Skip to main content
15,741,818 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
cmdselect.CommandText = "select PD.Prod_ID,PD.Prod_BrandName, PD.Prod_ModelNo,sum(iif(Isnull(PM.Prod_Qty), 0, PM.Prod_Qty)) as Purchase_Item,sum(iif(Isnull(SM.Prod_Qty), 0, SM.Prod_Qty)) as Sale_Item,sum(iif(Isnull(PM.Prod_Qty), 0, PM.Prod_Qty))-  sum(iif(Isnull(SM.Prod_Qty), 0, SM.Prod_Qty)) as Balance_Item from tbl_ProductDetails PD left join tbl_PurchaseMaster PM on [PD.Prod_ID]=[PM.Prod_ID] left join tbl_SaleMaster SM on [PD.Prod_ID]=[SM.Prod_ID] group by PD.Prod_ID,PD.Prod_ModelNo,PD.Prod_BrandName";


i m using this query to retrive data from Access database table but i m getting this error so plz help me...

error message is :-

"Syntax error (missing operator) in query expression '[PD.Prod_ID]=[PM.Prod_ID] left join tbl_SaleMaster SM on [PD.Prod_ID]=[SM.Prod_ID]'."
Posted

1 solution

Try:
SQL
... from tbl_ProductDetails PD left join tbl_PurchaseMaster PM on PD.Prod_ID=PM.Prod_ID left join tbl_SaleMaster SM on PD.Prod_ID=SM.Prod_ID ...

OR
SQL
from tbl_ProductDetails PD left join tbl_PurchaseMaster PM on PD.[Prod_ID]=PM.[Prod_ID] left join tbl_SaleMaster SM on PD.[Prod_ID]=SM.[Prod_ID]


Square brackets around the whole columname might be confusing and have no reference which table they are from.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900