Type DateFrom DateTo
Out 12/09/08 12/26/08
Out 01/01/09 01/14/09
In 12/27/08 01/13/09
In 02/15/09 03/31/09
1,要求当type=out的时候,查询日期在DateFrom和DateTo 之间的数据不应该显示出来
1,要求当type=In的时候,查询日期在DateFrom和DateTo 之间的数据不应该显示出来[/code]如何写这个sql
解决方案 »
- SQL SERVER2000 社保系统两台机器都装了,有一个正常使用,另一个总是显示当日日结,用不成。
- [ODBC SQL Server Driver]在 SQL Server 上发生未知错误。服务器可能已终止连接。
- sql2000安装出错,急!
- 高手請教!
- SQL Server的动态游标?救急!
- SQL SERVER中AS的使用方法
- 怎么会出现'80040e31' 超时呢?
- 每个用户计算费用的公式不同,如何设计数据库更合理,公式怎样储存在数据库中,怎样读取计算
- 要求帮忙,多谢了
- sql 有没有函数根据日期判断是否为法定节假日或者春节
- [菜鸟问题]有外键的表的删除问题,新手在线等!
- 调用存储过程
from tb
where getdate not between DateFrom and DateTo这样?
from tb
where Type in('Out','In')
and getdate() not between DateFrom and DateTo
from tb join type as t
on by.type=t.type
where t.Type='Out' or
(datefield<DateFrom and datefield>DateTo and Type='In')
select *
from tb join type as t
on tb.type=t.type
where t.Type='Out' or
(datefield<DateFrom and datefield>DateTo and Type='In')
dep
rtn1,要求当type=out的时候,查询日期dep在DateFrom和DateTo 之间的数据不应该显示出来
2,要求当type=In的时候,查询日期rtn在DateFrom和DateTo 之间的数据不应该显示出来
select * from table where id not in
(select id from table where (type='out' and DateFrom<dep<DateTo) or (type='in' and Datefrom<rtn<DateTo))