MySQL - DISTINCT values on a multi table select...

Hi,  I should know this one, but have always side stepped the need to find out before..

I am doing a select, joining two tables, but I want the results to be DISTINCT by HOUSEHOLD_ID, while I still want the rest of the data to test on.

With 5 rows in the table, this:

SELECT DISTINCT * from GAMES_PLAYED GP, HOUSEHOLD H where H.HOUSEHOLD_ID=GP.HOUSEHOLD_ID AND GP.CREATED_TIMESTAMP >= '2013-05-20 16:00:00' AND GP.CREATED_TIMESTAMP < '2013-05-21 16:00:00' ORDER BY SCORE1_VALUE DESC LIMIT 50

Gives me:
15 201 32132
15 203 2322
15 204 832
2 202 736
7 200 0

But I need it to be distinct on the first value and give me:
15 201 32132
2 202 736
7 200 0

Top points for a quick answer.

Thanks,

Cris.

PS. Where is MySQL in the question topics?
CrisThompsonUKAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Ray PaseurConnect With a Mentor Commented:
0
 
CrisThompsonUKAuthor Commented:
BOOM.  Sorted.
0
 
Ray PaseurCommented:
Thanks for the points and good luck with your project, ~Ray
0
All Courses

From novice to tech pro — start learning today.