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

Two LEFT OUTER JOINs

Status
Not open for further replies.

donmesserli

Programmer
May 6, 2004
1
US
I am trying to do two LEFT OUTER JOINs. I am using sqlite. The following code DOES NOT work (I get a syntax error)...

SELECT a.AutoID, a.Active FROM Automobiles AS a LEFT OUTER JOIN Units AS u ON a.UnitID = u.UnitID WHERE u.UnitNumber>='6' AND u.UnitNumber<'7' LEFT OUTER JOIN ParkingSpots AS p ON a.ParkingSpotID = p.SpotID ORDER BY Make , Model asc

If I remove the second LEFT OUTER JOIN, it WORKS (except for not getting all the data from the ParkingSpots table I need)...

SELECT a.AutoID, a.Active FROM Automobiles AS a LEFT OUTER JOIN Units AS u ON a.UnitID = u.UnitID WHERE u.UnitNumber>='6' AND u.UnitNumber<'7' ORDER BY Make , Model asc

If I remove the WHERE clause and leave in the second LEFT OUT JOINT, it WORKS (except for the fact that I get all of the Units)...

SELECT a.AutoID, a.Active FROM Automobiles AS a LEFT OUTER JOIN Units AS u ON a.UnitID = u.UnitID LEFT OUTER JOIN ParkingSpots AS p ON a.ParkingSpotID = p.SpotID ORDER BY Make , Model asc

Can anybody tell me what I'm doing wrong? Or is it a bug in SqLite?

Don Messerli
 
All the Join clause must precede the Where clause.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top