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.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
"Lyn" wrote:
> 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.
>|||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
"Alejandro Mesa" wrote:
> 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
>
> "Lyn" wrote:
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment