Case _ when mistakes.

Category: MS-SQL Server -> Applications Author: q413731591 Date: 2001-07-08 10:59:26
 
q413731591
2001-07-08 10:59:26
select * from AttCardData a, peremployee b where a.empid = b.empid and

case when b.incubency = 1 then a. yymmdd> = b.comedate else a.yymmdd between b.comedate and b.leaveadate

error message:
Server: Msg 170, Level ; 15, State 1, Line 2
Line 2: Incorrect syntax near '>'.

ask how to modify.
qq30744280
2001-07-08 11:16:10
case when b.incubency = 1 then a.yymmdd> = b.comedate else a.yymmdd between b.comedate and b.leaveadate end
=
?
((b.incunbency=1 AND a.yymmdd>=b.comedate) OR (a.yymmdd BETWEEN b.comedate AND b.leaveadate))
hz521234
2001-07-08 11:19:56
select *
from AttCardData a, peremployee b
where a. empid = b.empid and
case when b.incubency = 1 then a.yymmdd> = b.comedate else a.yymmdd between b.comedate and b . leaveadate

case when there can not be used in the where syntax does not support ...

select *
from AttCardData a join (select * from peremployee where ncubency=1 ) b on a.yymmdd>=b.comedate
                   join (select * from peremployee where ncubency<1 or ncubency>1) c on a.yymmdd between c.comedate and c.leaveadate

try it ~
jack2000j
2001-07-08 11:30:39
select * from AttCardData a, peremployee b where a.empid = b.empid and

case when ; b.incubency = 1 then a.yymmdd> = b.comedate else a.yymmdd between b.comedate and b.leaveadate end
error message above.
my_new1
2001-07-08 11:46:29
do not understand, but feel you too.
xuedizhilang
2001-07-08 11:50:31
select * from AttCardData a, peremployee b where ; a.empid = b.empid and

case when b.incubency = 1 then a.yymmdd <b.comedate else a.yymmdd> b . leaveadate

error message:
Server: Msg 170, Level 15, State 1, Line 2
Line 2: Incorrect syntax near '>'.

take exception cards.

b.incubency = 1 judgment on whether the job, if the job, then the judge his punch record is less than his entry date,
If you leave, you judge him The punch record is greater than his departure dates
wellpiekcf
2001-07-08 12:02:27
select * from AttCardData a ,peremployee b where a.empid=b.empid 
and ((b.incubency=1 and a.yymmdd<b.comedate) or (b.incubency<>1 and a.yymmdd >b.leaveadate))
songys893
2001-07-08 12:22:02
die, so that efficiency would be more bottom up. peremployee records than larger.
afakljfajofjoaijfjao
2001-07-08 12:24:37
separate queries, combined with the union all no good

select * from AttCardData a ;, peremployee b where a.empid = b.empid and
b.incubency = 1 and a.yymmdd> = b.comedate

union ; all

select * from AttCardData a, peremployee b where a.empid = b.empid and
b.incubency <> 1 and a.yymmdd between b.comedate and b.leaveadate
zdf2000362
2001-07-08 12:31:16
Can I use case when statement to determine the date of it?
zhoutao927
2001-07-08 12:50:40
landlord, "case when b.incubency = 1 then a.yymmdd> = b.comedate else a.yymmdd between b.comedate and b.leaveadate"
case conditional place where mistakes behind, for a logical expression
kulo0000
2001-07-08 12:55:45
- | slow on incubency field indexed ..
yuzhustar
2001-07-08 13:10:29
Hee hee, thank you. Wanted to ask you a comparison with how to write SQL statements go, of course, can not be indexed on the field in incubency the
this is just take 1 and 0
sleepyshen
2001-07-08 13:14:14
1 and 0 if the balance of ... do not add an index ....