我試圖與其中可能包含具有相同id_type
更多的價值就像這個例子表中的SELECT
:MySQL的:集團最先進的最新結果與同ID_TYPE唯一
table_intensity
id id_type value user_id creation_date
1 1 90.4 73 2010-11-06 16:27:32
2 4 1258 27 2010-11-06 16:27:48 <= up-to-date id_type
3 3 1.9 73 2010-11-06 16:31:02 <= up-to-date id_type
4 1 88.8 12 2010-11-06 16:33:11
5 1 89.1 12 2010-11-06 16:58:20 <= up-to-date id_type
我怎樣才能獲得每個id_type的最新信息?我想是這樣的,但這麼想的工作:
SELECT * FROM table_intensity GROUP BY id_type ORDER BY id_type, creation_date
這要得到這樣的結果:
table_intensity
id id_type value user_id creation_date
2 4 1258 27 2010-11-06 16:27:48
3 3 1.9 73 2010-11-06 16:31:02
5 1 89.1 12 2010-11-06 16:58:20
我猜你還需要ORDER BY CREATION_DATE DESC – kalpaitch 2010-11-07 00:29:16