高手看看这句sql查询条件反规则怎么写

[复制链接]
查看11 | 回复3 | 2008-12-18 09:01:29 | 显示全部楼层 |阅读模式
select * from data where type=0 and and selldate between '"&nowstartdate&"' and '"&nowenddate&"'
---------------------------------------
selldate 是时间型字段 上面是查询在某一时间段between '"&nowstartdate&"' and '"&nowenddate&"' 内的数组。
如果要作为反条件查询应该怎么写?
即取除某一时间段between '"&nowstartdate&"' and '"&nowenddate&"'以外的所有数组。
---------------------
我只有20分全给你了
听说可以用 not in ,怎么写?我试过几个方法都是脚本超时。

回复

使用道具 举报

千问 | 2008-12-18 09:01:29 | 显示全部楼层
select * from data where type=0 and selldate not between '"&nowstartdate&"' and '"&nowenddate&"' between前加not就行,不过你前边的语句好像多了个and...
回复

使用道具 举报

千问 | 2008-12-18 09:01:29 | 显示全部楼层
试试这样写select * from data where type=0 and (selldate'"&nowenddate&"')...
回复

使用道具 举报

千问 | 2008-12-18 09:01:29 | 显示全部楼层
高手,看不懂啥意思。- -,...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行