联接: SELECT L.类别 , L.日期, L.数量 FROM table L JOIN table R ON L.类别 = R.类别 GROUP BY L.类别 , L.日期, L.数量 HAVING L.日期= Max(R.日期)子查询: select * from table where 日期 in (select max(日期) from table group by 类别)
select distinct a.类别,b.日期,b.数量 from table a inner join table b on a.类别 = b.类别 where b.日期 = (select max(c.日期) from table c where c.类别 = a.类别) order by a.类别
SELECT L.类别 , L.日期, L.数量
FROM table L
JOIN table R
ON L.类别 = R.类别
GROUP BY L.类别 , L.日期, L.数量
HAVING L.日期= Max(R.日期)子查询:
select * from table
where 日期 in (select max(日期) from table group by 类别)
from table a
inner join table b
on a.类别 = b.类别
where b.日期 = (select max(c.日期)
from table c where c.类别 = a.类别)
order by a.类别
happydreamer 的联接方法有些看不懂 呵呵
各位的试过了 都行