Related questions
How can I SELECT rows with MAX(Column value), DISTINCT by another column in SQL?
My table is:
id home datetime player resource
---|-----|------------|--------|---------
1 | 10 | 04/03/2009 | john | 399
2 | 11 | 04/03/2009 | juliet | 244
5 | 12 | 04/03/2009 | borat | 555
3 | 10 | 03/03/2009 | john | 300
4 | 11 | 03/03/2009 | juliet | 200
6 | 12 | 03/03/2009 | borat | 500
7 | 13 | 24/12/2008 | borat | 600
8 | 13 | 01/01/2009 | borat | 700
I need to select each distinct home holding the maximum value of datetime.
Result would be:
id home datetime …
MAX function in where clause mysql
How can I use max() function in where clause of a mysql query, I am trying:
select firstName,Lastname,MAX(id) as max where id=max;
this is giving me an error:
Unknown column 'max' in 'where clause'
Any Help? …