Jump to content

Left Join query not working


harkly

Recommended Posts

Can someone take a look at my query? It was working until I add the 2nd Left Join.

 

Never had more that one Join in my quieries so not really sure of what I am doing.

 

         $query = ("SELECT user.userID, user.gender, user.bd_year, user.city, user.state, photos.userID, photos.photo_1, about_me.smoking,
                           CURDATE(), YEAR(CURDATE())-YEAR(birth_date)) - (RIGHT(CURDATE(),5)<RIGHT(birth_date,5)) AS age
                    FROM user
                    LEFT JOIN photos
                    ON user.userID = photos.userID
                    LEFT JOIN about_me
                    ON user.userID = about_me.userID
                    WHERE user.bd_year <= $year1 AND user.bd_year >= $year2 AND user.gender = $genderPref AND about_me.smoking = $smoke");

 

 

Link to comment
https://forums.phpfreaks.com/topic/206209-left-join-query-not-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.