scotchegg78 Posted July 3, 2008 Share Posted July 3, 2008 Hi guys I have this query. SELECT pal_member.name as name,pal_member.id as id,pal_member.dob as dob FROM pal_member,pal_friends WHERE (WEEK(dob) = WEEK(DATE_ADD(CURDATE(),INTERVAL 3 DAY))) AND (pal_friends.pal_1 = '97' OR pal_friends.pal_2 = '97') where I am attempting to get all members with a birthday upcoming in the next 10 days, ofwhich I am friends with. It uses the pal_members table and the pal_friends table which links the id's. However the current call gets all the birdthday people right, but messes up the friends part and i get to much data. I think it needs a join of some sort , but I am confused as i am not joining on ids from both tables. My train of thought was simple get the data from the members table with upcoming birdthdays, then filter this against seeing if the members id is paired up in the friends table? any ideas on this, as I can not quite get my head around this join many thanks for any tips Quote Link to comment Share on other sites More sharing options...
fenway Posted July 3, 2008 Share Posted July 3, 2008 How are these two tables related? 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.