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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.