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

请问个查询语句

2012-03-16 
请教个查询语句我得数据是这样的codedate0052007-6-50022006-6-70132006-6-100012006-6-120152006-6-15根

请教个查询语句
我得数据是这样的
code             date
005               2007-6-5
002               2006-6-7
013               2006-6-10
001               2006-6-12
015               2006-6-15
根据时间排序,然后获取指定code之后的数据列表
比如要求获取013之后的数据   则得到结果为
013               2006-6-10
001               2006-6-12
015               2006-6-15
注:code是乱序排列的   怎么写查询语句呀

[解决办法]
select code,date from 表
where date> =(select date from 表 where code> = '013 ')
[解决办法]
select * from table1 A where A.date > = (select B.date from table1 B where B.code = '013 ') order by A.date
[解决办法]
select * from tablename
where date> =(select top 1 date from tablename where code= '013 ' order by date)
order by date

[解决办法]
汗,都寫出來了。

热点排行