0

I have written a query in MS Access when i am trying to run this query i am getting an error. I can't find out the problem in it.

SELECT 
p.[ID] as [ID],
 p.[Code] as [CODE],
p.[DESCRIPTION] as [DESCRIPTION],
p.[Coloring] as [Coloring],
 p.[Sizing] as [Sizing],
p.[BarCode] as [Barcode],
p.[PartsNo] as [PartsNo],
p.[HSN_SAC] as [HSN_SAC],
p.[GSTRate] as [GSTRate],
p.[Remarks] as Remarks,
c.[CODE] as [CategoryCode],
c.[Description] as [CategoryDescription],
b.[CODE] as [BrandCode],
b.[Description] as [BrandDescription],
s.[Id] as [SupplierId],
s.[Code] as [SupplierCode],
s.[Description] as [SupplierDescription] 
FROM [PRODUCTMASTER] p LEFT JOIN [CATEGORYMASTER] c on p.[CategoryId] = c.[ID] 
LEFT JOIN [BRANDMASTER ] b on p.[BrandId] =  b.[ID] 
LEFT JOIN [SUPPLIERAMSTER] s on p.[SupplierId] =  s.[ID]

enter image description here

2
  • It might be the space after BRANDMASTER or the misspelling of SUPPLIERAMSTER. Commented Jul 23, 2017 at 7:18
  • i did check again, till now no spelling mistake found @AndyG Commented Jul 23, 2017 at 7:25

1 Answer 1

1

When you linking more than two tables, brackets required:

FROM (([PRODUCTMASTER] p LEFT JOIN [CATEGORYMASTER] c on p.[CategoryId] = c.[ID]) 
LEFT JOIN [BRANDMASTER ] b on p.[BrandId] =  b.[ID]) 
LEFT JOIN [SUPPLIERAMSTER] s on p.[SupplierId] =  s.[ID]

I would recommend to build SQL queries using query builer, it's much easier than manually and you won't have misspelling and bracketing errors like this. Check one more time for the space after [BRANDMASTER ], this is bad practice in any case. Remove trailing space from column name in table definition, it may cause other weird errors.

Sign up to request clarification or add additional context in comments.

1 Comment

space removed but still getting the error. i don't understand why.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.