Page 1 of 1

Join -> limit records per user

Posted: Tue Aug 01, 2006 3:50 pm
by seodevhead
Hey guys... I have a database table called 'users' and an associated table called 'profile_pics' that has records for uploaded pictures for any associated user that chooses to upload one.

The thing is, one user can have many profile pictures, but on this particular page I am making, I want only the most recent profile picture to display for each user.

So I want my select query to retrieve all profile pictures from all members who have a profile picture(s), but only display one profile picture for each member (eventhough they may have more than one). How can I go about doing that in my SELECT statement? Any ideas how I can work this out? Thanks for your help.

Posted: Tue Aug 01, 2006 3:54 pm
by feyd
I would imagine a GROUP BY clause would handle it.