首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > Access >

50求一SQL语句,正解即结贴!该怎么处理

2012-03-08 
50求一SQL语句,正解即结贴!news表cid(文本)ctitlebigclassIDinfotime20060406100018asdf20060315100001200

50求一SQL语句,正解即结贴!
news表
cid(文本)                     ctitle             bigclassID                           infotime
20060406100018           asdf               20060315100001               2006-5-6   14:54:57
20060406100019           qwer               20060315100002               2006-6-6   14:54:57
20060406100020           awer               20060315100002               2006-6-814:54:57
20060406100021           sdf                 20060315100003               2006-7-6   14:54:57
20060406100022           12asdf           20060315100001               2007-5-6   14:54:57
20060406100023           3qwer             20060315100002               2007-6-6   14:54:57
20060406100024         4awer               20060315100004             2007-7-6   14:54:57
20060406100025           4sdf               20060315100003               2007-8-6   14:54:57

bigclass表
bigclassID                           name
20060315100001                     a
20060315100002                     b
20060315100003                     c
20060315100004                     d

查询出每类新闻的cid值最大的两条记录.也就是每类新闻最新的两条数据.大家帮忙.



[解决办法]
SELECT *
FROM News as A
where cid in (select top 2 cid from News where bigclassID=A.bigclassID order by cid desc)

热点排行