Error  
Author Message
tonywa





PostPosted: Thu Feb 17 14:43:07 CST 2005 Top

SQL Server Developer >> Error

select showed_up =
case client_regist when (isnull(s.client_regist,'')='')
and (s.clin_appt_status like '%cancel%')
then 'cancel'
ELSE 'Unknown'END,count(p.lognum) as 'MonthlyNoshow'
from t_client p inner join t_schedule s on
p.lognum = s.log_no where s.Create_dt between '11/01/04'
and '11/05/04'
and p.ic_status like '4un%'
group by client_regist

I get this error when I run this code:
Server: Msg 170, Level 15, State 1, Line 2
Line 2: Incorrect syntax near '='.

Can you help me identify my mistake??
Thanks.

SQL Server258  
 
 
AlejandroMesa





PostPosted: Thu Feb 17 14:43:07 CST 2005 Top

SQL Server Developer >> Error Try,

select
case client_regist
when (isnull(s.client_regist,'')='') and (s.clin_appt_status like
'%cancel%') then 'cancel'
ELSE 'Unknown'
END as showed_up,
count(p.lognum) as 'MonthlyNoshow'
from
t_client p
inner join
t_schedule s
on p.lognum = s.log_no
where
s.Create_dt between '11/01/04' and '11/05/04'
and p.ic_status like '4un%'
group by
client_regist
go


AMB




> select showed_up =
> case client_regist when (isnull(s.client_regist,'')='')
> and (s.clin_appt_status like '%cancel%')
> then 'cancel'
> ELSE 'Unknown'END,count(p.lognum) as 'MonthlyNoshow'
> from t_client p inner join t_schedule s on
> p.lognum = s.log_no where s.Create_dt between '11/01/04'
> and '11/05/04'
> and p.ic_status like '4un%'
> group by client_regist
>
> I get this error when I run this code:
> Server: Msg 170, Level 15, State 1, Line 2
> Line 2: Incorrect syntax near '='.
>
> Can you help me identify my mistake??
> Thanks.
>
 
 
AlejandroMesa





PostPosted: Thu Feb 17 14:47:04 CST 2005 Top

SQL Server Developer >> Error Correction,

select
case
when (isnull(s.client_regist,'')='') and (s.clin_appt_status like
'%cancel%') then 'cancel'
ELSE 'Unknown'
END as showed_up,
count(p.lognum) as 'MonthlyNoshow'
from
t_client p
inner join
t_schedule s
on p.lognum = s.log_no
where
s.Create_dt between '11/01/04' and '11/05/04'
and p.ic_status like '4un%'
group by
client_regist
go


AMB




> Try,
>
> select
> case client_regist
> when (isnull(s.client_regist,'')='') and (s.clin_appt_status like
> '%cancel%') then 'cancel'
> ELSE 'Unknown'
> END as showed_up,
> count(p.lognum) as 'MonthlyNoshow'
> from
> t_client p
> inner join
> t_schedule s
> on p.lognum = s.log_no
> where
> s.Create_dt between '11/01/04' and '11/05/04'
> and p.ic_status like '4un%'
> group by
> client_regist
> go
>
>
> AMB
>
>

>
> > select showed_up =
> > case client_regist when (isnull(s.client_regist,'')='')
> > and (s.clin_appt_status like '%cancel%')
> > then 'cancel'
> > ELSE 'Unknown'END,count(p.lognum) as 'MonthlyNoshow'
> > from t_client p inner join t_schedule s on
> > p.lognum = s.log_no where s.Create_dt between '11/01/04'
> > and '11/05/04'
> > and p.ic_status like '4un%'
> > group by client_regist
> >
> > I get this error when I run this code:
> > Server: Msg 170, Level 15, State 1, Line 2
> > Line 2: Incorrect syntax near '='.
> >
> > Can you help me identify my mistake??
> > Thanks.
> >