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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Left Join 1

Status
Not open for further replies.

litton1

Technical User
Apr 21, 2005
584
GB
Can anybody see what is wrong with this simple query? The error seems to be in the Left Join

Code:
SELECT  p.[P_ItemID] AS ProductID,  i.[Name],  PQ.[QuantityOnStock]
FROM  [Products] p  
 INNER JOIN [Items] i ON i.[I_ItemID] = p.[P_ItemID]  
  LEFT JOIN ProductQuantitys PQ ON PQ.[PQ_ItemID] = p.[P_ItemID]

Thx L

Age is a consequence of experience
 
access requires parentheses when there is more than one join in a query
Code:
SELECT p.P_ItemID AS ProductID
     , i.Name
     , PQ.QuantityOnStock
  FROM [b][red]([/red][/b]
       Products AS p   
INNER 
  JOIN Items AS i 
    ON i.I_ItemID = p.P_ItemID   
       [b][red])[/red][/b] 
LEFT OUTER
  JOIN ProductQuantitys AS PQ 
    ON PQ.PQ_ItemID = p.P_ItemID

r937.com | rudy.ca
Buy my new book Simply SQL from Amazon
 
Thanks that works now. Have a star.

Age is a consequence of experience
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top