select * from telecast
where
cast (playdate+' '+laybegin as datetime) between '2003-04-1 05:00:00'
and '2003-04-2 05:00:00'
where
cast (playdate+' '+laybegin as datetime) between '2003-04-1 05:00:00'
and '2003-04-2 05:00:00'
解决方案 »
- 求教SQL按这种方式自动编号
- 想下载一个论坛,放在公司的服务器上,就让内网使用。主要是让员工发些供求信息。
- ★沮丧的小白:分页的存储过程。
- SQL视图导出变成数据表,有什么办法呢?
- 大菜鸟的小问题
- 在sql server中有有像在access里的“是/否”型字段吗?假如有的话是那一个,没有的话又是怎么处理boolean的?
- 一个关联的sql?
- 关于SQL SERVER 日期的计算存在的问题, 不知你们有没有遇过过, 很奇怪。
- 复制同步问题:Windows 2003 配置分发数据库时:错误(distributor_admin未在该服务器上未定义为远程登录)
- 创建SQL Server数据库的问题,快来救命啊!~~
- 高手请进,这种要求的SELECT语句怎么实现(前面已结贴,继续细化)
- 分布式查询!!
where ( playdate >= '2003-04-1 05:00:00' and playdate <= '2003-04-2 03:00:00')
select * from telecast
where year(playdate)*365*24+month(playdate)*30*24+day(playdate)*24 >= 2003*365*24+4*30*24+1*24+5
and year(playbegin)*365*24+month(playbegin)*30*24+day(playbegin)*24 <= 2003*365*24+4*30*24+2*24+3
查询2003-4-1年05:00:00至2003-4-2年03:00:00之间的数据,要playbegin干嘛?
select * from TABLE a where sho2<=3
where exists (select ISNULL(count(*),0) from TABLE where a.sho1=sho1 and a.sho2=sho2
AND sh09<>0 group by sho1 having count(*)=0)
呆滯 4-6
select * from TABLE a where sho2>=4 AND sho2<=6
where exists (select ISNULL(count(*),0) from TABLE where a.sho1=sho1 and a.sho2=sho2 AND ISNULL(sh09,0)<>0 group by sho1 having count(*)=0
呆滯 7-10
select * from TABLE a where sho2>=7 AND sho2<=10
where exists (select ISNULL(count(*),0) from TABLE where a.sho1=sho1 and a.sho2=sho2 AND ISNULL(sh09,0)<>0 group by sho1 having count(*)=0
呆滯 12
select * from TABLE a where sho2=12
where exists (select ISNULL(count(*),0) from TABLE where a.sho1=sho1 and a.sho2=sho2 AND ISNULL(sh09,0)<>0 group by sho1 having count(*)=0
)
呆滯 24
select * from TABLE a where sho2=24
where exists (select ISNULL(count(*),0) from TABLE where a.sho1=sho1 and a.sho2=sho2 AND ISNULL(sh09,0)<>0 group by sho1 having count(*)=0
)
没办法,我也知道playbegin是个累赘,但是数据表是人家的,我只是负责读出来。该不料的
where playdate >= '2003-04-1 05:00:00'
and playdate <= '2003-04-2 03:00:00'
where ( playdate + playbegin ) between '2003-04-1 05:00:00'
and '2003-04-2 03:00:00'
where cast(convert(varchar(10),playdate,120)+ ' ' + convert(varchar(10),playbegin,108) as datetime) between '2003-04-1 05:00:00' and '2003-04-2 03:00:00'