SQL: Select a row only if that cell has the max value given the ID -


i realize title of question more difficult question itself.

basically have dataset one:

id  hour 01  1 01  2 01  3 02  1 02  2 03  1 03  2 03  3 03  4 

the dataset refers people playing game. id is, of course, id of subject whilst 'hour' refers happened in hour of game. now, select rows refer last hour played player.

so that:

id  hour 01  3 02  2 03  4 

any ideas?

simply use max()

select id, max(hour) max_hour   tablename group  id 

Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -