i have problem sql
query
.
this code:
set @timecoming=(select timecoming bill) set @timecome= datepart(hour,@timecoming) if(@timecome>=22 , @timecome<=23) begin set @bill=@byday set @day=1 set @hour=0 end if(@timecome>=21 , @timecome<22) begin set @bill=@byhour set @day=0 set @hour=1 end if(@timecome>=21 , @timecome<=23 , @timecome not in (@timecome>=21 , @timecome<22)) begin set @bill=@byday set @day=1 set @hour=0 end
as see, want 3rd condition - timecome not in 21:00 , 22:00
set bill=byday , day=1
. because of 2nd condition used parameter. have error
"incorrect syntax near '>'."
please me problem, thank !
update
this idea:
- if customer come in 21:00 , go in 22:00 (21:00 22:00) => @bill=@byhour.
- if customer come in 22:00 , go in 23:00 (22:00 23:00) => @bill=@byday.
- if customer come in 21:00 , go in 23:00 (21:00 23:00) => @bill=@byday.
this should be:
if(@timecome>=21 , @timecome<=23 , not (@timecome >= 21 , @timecome<22))
but can simplified:
if(@timecome>=22 , @timecome<=23)
but have have first if
statement...
Comments
Post a Comment