--查询
select * from 表 a
where 时间=(
select min(时间) from 表
where 时间>=convert(varchar(13),a.时间)+':00')
select * from 表 a
where 时间=(
select min(时间) from 表
where 时间>=convert(varchar(13),a.时间)+':00')
解决方案 »
- 高分请教:让sql数据库定时到指定的地方读取txt数据 并将数据导入指定的表 怎么做啊?
- 第一天学SQL,一句话就可以回答的问题,谢谢大家了。
- 如何利用触发器进行定时存储?着急!!!谢谢!
- 直接从一个视图里掉20000条数据,用什么方法最快呢?我现在用的是vb+mssql
- 【讨论】MSSQL2005如何修改自定义数据类型?
- SQL语句条件的先后顺序,真是怪!!!
- 求救~~~分发订阅问题!
- 如何写select语句列出数据库中某ID范围段,如001-100之间缺乏的数字?
- VFP中,text获得焦点后,能否处于选中状态,就是,向text中枢如是能自动替换原有内容?
- 简单问题:为什么在设置identity属性的列上删除记录,序号不能删除?
- 求助!zjcxc(邹建)请进 !
- 看看我写的存储过程有没有错误?
create table 表(id int,时间 datetime,data int)
insert 表 select 1,'2004-3-19 1:00:00',200
union all select 2,'2004-3-19 1:03:00',400
union all select 3,'2004-3-19 2:00:00',300
union all select 4,'2004-3-19 2:01:00',800
union all select 5,'2004-3-19 3:00:00',700
union all select 6,'2004-3-19 3:01:00',700
union all select 7,'2004-3-19 3:02:00',200
go--查询
select * from 表 a
where 时间=(
select min(时间) from 表
where 时间>=convert(varchar(13),a.时间)+':00')go--删除测试
drop table 表/*--测试结果
id 时间 data
----------- ------------------------------------------------------ -----------
1 2004-03-19 01:00:00.000 200
3 2004-03-19 02:00:00.000 300
6 2004-03-19 03:01:00.000 700(所影响的行数为 3 行)
--*/
create table 表(id int,时间 datetime,data int)
insert 表 select 1,'2004-3-19 1:00:00',200
union all select 2,'2004-3-19 1:03:00',400
union all select 3,'2004-3-19 2:00:00',300
union all select 4,'2004-3-19 2:01:00',800
union all select 5,'2004-3-19 3:00:00',700
union all select 6,'2004-3-19 3:01:00',700
union all select 7,'2004-3-19 3:02:00',200
go--查询
select * from 表 a
where 时间=(
select min(时间) from 表
where 时间>=convert(varchar(13),a.时间)+':00')go--删除测试
drop table 表/*--测试结果
id 时间 data
----------- ------------------------------------------------------ -----------
1 2004-03-19 01:00:00.000 200
3 2004-03-19 02:00:00.000 300
5 2004-03-19 03:00:00.000 700(所影响的行数为 3 行)--*/
字段
id 时间 data
1 2004-3-19 1:01:00 200
2 2004-3-19 1:02:00 400
3 2004-3-19 1:03:00 300
4 2004-3-19 1:04:00 800
5 2004-3-19 2:00:00 700
6 2004-3-19 2:01:00 700
7 2004-3-19 2:02:00 200
的话要取分钟值怎么取!!!