有表如下 CREATE TABLE test ( id INTEGER PRIMARY KEY ,groupid INTEGER DEFAULT 0 ,t INTEGER DEFAULT 0 ,x INTEGER DEFAULT 0 ,y INTEGER DEFAULT 0 )內(nèi)容 REPLACE INTO test (id,groupid, t ,x,y)select 1,1,100,8,8 union all select 2,1,80 ,7,7 union all select 3,1,50,6,6 union all select 4,2,100,5,5要求結(jié)果,找到每個groupid中t最大的記錄的完整展示(即id 1,4) 1 1 100 8 8 4 2 100 5 5現(xiàn)在使用 select * from test group by groupid order by t desc 無法達到要求,跪求正確的方法
添加回答
舉報
0/150
提交
取消