SELECT CASE WHEN CAST(CONVERT(VARCHAR(8),GETDATE(),108) AS DATETIME) = '7:30' THEN 1 ELSE 0 END SELECT CASE WHEN DATEPART(hh,GETDATE())*60+DATEPART(mm,GETDATE()) = 7*60+30 THEN 1 ELSE 0 END
这条语句再把下班时间3 OUT3等于 07:30 时间的条件找出来,请问加什么条件进去?select * from KQ_DateReport where iodate>='2010-08-01' and iccardid='0008215657'
select * from KQ_DateReport where iodate>='2010-08-01' and iccardid='0008215657' and datepart(hh,iodate)=7 and datepart(mi,iodate)=30
select * from KQ_DateReport where iccardid='0008215657' and ( iodate>='2010-08-01' and datepart(hh,iodate)=7 and datepart(mi,iodate)=30)
什么也没有代表没有满足条件的记录啊~我知道为什么没记录了,SQL应该是下面这样的 select * from KQ_DateReport where iodate>='2010-08-01' and iccardid='0008215657' and datepart(hh,OUT3)=7 and datepart(mi,OUT3)=30是OUT3的时间是07:30,不是iodate的时间为07:30。囧啊~~~审题不清~~~
where datepart(hh,datefield)=7 and datepart(mi,datefield30
where datepart(hh,datefield)=7 and datepart(mi,datefield)=30
16:08:31
select * from KQ_DateReport where iodate>='2010-08-01' and iccardid='0008215657'
and datepart(hh,iodate)=7 and datepart(mi,iodate)=30
select * from KQ_DateReport where iccardid='0008215657'
and ( iodate>='2010-08-01' and datepart(hh,iodate)=7 and datepart(mi,iodate)=30)
什么也没有代表没有满足条件的记录啊~我知道为什么没记录了,SQL应该是下面这样的
select * from KQ_DateReport where iodate>='2010-08-01' and iccardid='0008215657'
and datepart(hh,OUT3)=7 and datepart(mi,OUT3)=30是OUT3的时间是07:30,不是iodate的时间为07:30。囧啊~~~审题不清~~~