Davie33 Posted August 21, 2013 Share Posted August 21, 2013 Hi can any one see what is wrong with this query please I have tryed a few ways of doing it but can't get it to work. Thanks in adavnce. Error No: 0 - MySQL error Column 'id' in where clause is ambiguous Query: "SELECT shouts.id,shouts.text,shouts.date,shouts.name,user.id,user.username,user.avatarfile,user.useavatar FROM shouts LEFT JOIN user ON shouts.name = user.username WHERE shouts.id = id ORDER BY shouts.date = 'date' ASC LIMIT 20" Quote Link to comment Share on other sites More sharing options...
kicken Posted August 21, 2013 Share Posted August 21, 2013 You have an ID column in both tables, so you need to be explicit about which table's ID column you are referring to. In your WHERE clause, you have the condition: shouts.id = id The second id column reference has no table prefix so mysql does not know which id column it should use. Quote Link to comment Share on other sites More sharing options...
Davie33 Posted August 21, 2013 Author Share Posted August 21, 2013 (edited) Hi i think i have sorted it by doing this... "SELECT shouts.text,shouts.date,shouts.name,user.id,user.username,user.avatarfile,user.useavatar FROM shouts LEFT JOIN user ON shouts.name = user.username ORDER BY shouts.date = 'date' ASC LIMIT 20" Plus i don't see any errors in my log . Edited August 21, 2013 by Davie33 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.