select * from car where id in (select carid from license where appid not in (select id from application where allowed=1 and begintime<=getdate() and endtime>=getdate()))
1.我想要的汽车记录不一定在license里有没有 如果没有,肯定是可以 如果有,但时间不冲突也可以select * from car where id not in (select carid from license where appid in (select id from application where allowed=1 and begintime<=getdate() and endtime>=getdate()))2.getdate()是什么 基本SQL有吗 我一定要用基本SQL来实现getdate()得到现在系统时间!3.时间是否冲突也不能用一个判断呀,有一个小时搭上也不可以 谢谢大家帮忙看看你不是SQLServer吗?
select * from car where id not in (select carid from license where appid in (select id from application as AA where allowed=0 and not exists (select * from application where allowed=1 and AA.begintime>=begintime and AA.endtime<=endtime)))
1.我想要的汽车记录不一定在license里有没有
如果没有,肯定是可以 如果有,但时间不冲突也可以
2.getdate()是什么 基本SQL有吗 我一定要用基本SQL来实现
3.时间是否冲突也不能用一个判断呀,有一个小时搭上也不可以
谢谢大家帮忙看看
如果没有,肯定是可以 如果有,但时间不冲突也可以select * from car where id not in (select carid from license where appid in (select id from application where allowed=1 and begintime<=getdate() and endtime>=getdate()))2.getdate()是什么 基本SQL有吗 我一定要用基本SQL来实现getdate()得到现在系统时间!3.时间是否冲突也不能用一个判断呀,有一个小时搭上也不可以
谢谢大家帮忙看看你不是SQLServer吗?
现在这样还是不太对
最重要的是
不是和系统时间比,是待批准的时间段和和所有已经批准的时间段比,把所有不冲突的挑出来
最麻烦的是
时间段和时间段比,要比4次
被批准的 b----e
申请的 b----e 可以
b----e 可以
b----e 不可以
b-----------e 不可以
b-e 不可以
b----e 不可以
:)
谢谢
如果这个是对的,那也是一种时间段的检验
我怎么得到4个都检验的
要用一个SQL来解决
B为当前被选择的申请的开始时间
E为当前被选择的申请的结束时间
我应该用B替换AA.begintime还是begintime