I have MySQL statement like this:
SELECT profiles.* FROM profiles, categories WHERE categories.profile_id=profile.id AND categories.id in (1,2,3);
It's easy to see that if there are 2 categories for profile_id=1 (for example, profile1 belongs to categories 1 and 2), I will have 2 lines for this profile in the result set:
profile1
profile1
profile2
profile3
But what I need is simply to display the list of profiles for certain categories with no prfofiles doubled:
profile1
profile2
profile3
Can this be solved?
Thank you for attention.
SELECT profiles.* FROM profiles, categories WHERE categories.profile_id=profile.id AND categories.id in (1,2,3);
It's easy to see that if there are 2 categories for profile_id=1 (for example, profile1 belongs to categories 1 and 2), I will have 2 lines for this profile in the result set:
profile1
profile1
profile2
profile3
But what I need is simply to display the list of profiles for certain categories with no prfofiles doubled:
profile1
profile2
profile3
Can this be solved?
Thank you for attention.