? 什么意思?? Not Between 呢?select * from custom
where thedate not between '2005-10-10' and '2005-10-18'
where thedate not between '2005-10-10' and '2005-10-18'
解决方案 »
- MFC里怎么让DataGrid绑定数据源然后显示数据??
- 修改用户密码后SQLServer不能登陆
- java.sql.SQLException: 第 1 行: 't_update' 附近有语法错误。
- 菜鸟问题...对主键和外键的作用还是比较模糊..请指点
- SQL2005 如何将行转换成列
- 工具(Embarcadero SQLTuner 2.0.2)吗?如何才能有SQLserver功能(不好意思,没分了)
- 请高手赐教!急!往sql server的长二进制段中写数据的问题!
- 急!!!sql server2000 数据库连接问题
- 怎样从SQL 6.5升级到2000?
- sql server怎样写这样一个触发器呀
- 请高人帮助,谢谢
- 数据库中时间 一开始为null 然后update set sj='8:00:00'怎么全变成1900-1-1 8:00:00
declare @dt1 datetime,--开始时间
@dt2 datetime --结束时间
select @dt1='2005-09-20'
select @dt2='2005-09-25'
select * from custom a
where not exists(select 1 from custom where customname=a.customname and productname=a.productname and thedate between @dt1 and @dt2)
and a.thedate < @dt1
where thedate not between '2005-10-10' and '2005-10-18'
and thedate<'2005-10-10' 有什么问题吗??
select distinct productname,customname from main where not exists (select productname,customname from main where thedate>='2005-05-30' and thedate<='2005-05-30')后面哪个子查询出来的结果是正确的,前面哪个查询也是对的,就是两个差集时不对
declare @custom table(customname varchar(50),productname varchar(50),thedate datetime)
insert into @custom
select '金红叶','氧气','2005-09-20' union
select '金红叶','氧气','2005-10-17' union
select '金红叶','氮气','2005-09-25 '
--处理语句
declare @dt1 datetime,--开始时间
@dt2 datetime --结束时间
select @dt1='2005-10-10'
select @dt2='2005-10-18'
select * from @custom a
where not exists(select 1 from @custom where customname=a.customname and productname=a.productname and thedate between @dt1 and @dt2)
and a.thedate < @dt1--结果
/*
金红叶 氮气 2005-09-25 00:00:00.000
*/
declare @dt1 datetime,--开始时间
@dt2 datetime --结束时间
select @dt1='2005-10-10'
select @dt2='2005-10-18'
select distinct customname,productname
from
(select * from @custom a
where not exists(select 1 from @custom where customname=a.customname and productname=a.productname and thedate between @dt1 and @dt2)
and a.thedate < @dt1) new