Results 1 to 14 of 14
Thread: Addition to Join statement
Aug 21, 2012, 13:03 #1
- Join Date
- Aug 2004
- 0 Post(s)
- 0 Thread(s)
Addition to Join statement
I have a query that I use that is working a treat that basically checks 2 tables (one of images and one of users) and grabs users who have posted an image.
The query is listed below:
select tbl_users.user_id, tbl_users.user_display, max(tbl_images.image_day) as lastPost, max(tbl_images.image_date) as latestImage
on tbl_users.user_id = tbl_images.user_id
where tbl_images.image_day <= current_date
and tbl_users.user_status =1
group by tbl_users.user_id
order by lastpost desc, latestImage desc
My question is this, I have a 3rd table that lists people "I follow" can I query which simply has 2 fields - my user_id and their user_id - is there any way i can add this into the current query so that it adds another condition to say AND Where tbl_followers.user_id = tbl_uses.user_id.
Then it will be in laymans terms (the first bit is above - the braketed bit i need to add) - Get the latest photos [from people I follow]
No idea if any of that actually makes sense!