unemployment Posted May 2, 2011 Share Posted May 2, 2011 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `approved_date` > 1304300469 ORDER BY `approved_date` DESC ' at line 311 WHERE `approved_date` > ${time} ORDER BY `approved_date` DESC LIMIT 20 Quote Link to comment https://forums.phpfreaks.com/topic/235321-where-clause-error/ Share on other sites More sharing options...
PFMaBiSmAd Posted May 2, 2011 Share Posted May 2, 2011 The problem is right before the WHERE in your query. Quote Link to comment https://forums.phpfreaks.com/topic/235321-where-clause-error/#findComment-1209271 Share on other sites More sharing options...
unemployment Posted May 2, 2011 Author Share Posted May 2, 2011 The problem is right before the WHERE in your query. I actually am using multiple unions before the where and I think that is the problem. I should probably put the where in the unions. But now I'm getting a new error. #1052 - Column 'approved_date' in where clause is ambiguous One of the unions is posted below. ( SELECT users2.id, users2.firstname, users2.lastname, users2.username, '' AS industry, '' AS stage, '' AS companytag, users2.gender, users3.accounttype, users3.country, users3.state, users3.city, UNIX_TIMESTAMP(`partners3`.`approved_date`) AS `approved_date`, users3.id AS FeedId, users3.firstname AS FeedFirstName, users3.lastname AS FeedLastName, users3.username AS FeedUserName, '' AS action_id, '' AS details FROM users INNER JOIN partners ON partners.user_id = users.id AND partners.approved = 1 INNER JOIN users users2 ON users2.id = partners.friend_id INNER JOIN partners partners3 ON partners3.user_id = users2.id AND partners3.approved = 1 INNER JOIN users users3 ON users3.id = partners3.friend_id WHERE users.id = ${uid} AND `approved_date` = ${time} ) Quote Link to comment https://forums.phpfreaks.com/topic/235321-where-clause-error/#findComment-1209273 Share on other sites More sharing options...
Muddy_Funster Posted May 2, 2011 Share Posted May 2, 2011 thet meens that approved_date appears in more than one table in your select. Specify which table you wish to use and it fix that. Quote Link to comment https://forums.phpfreaks.com/topic/235321-where-clause-error/#findComment-1209332 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.