The below pulls everything I need except one field that I get errors when I try to add it.
I'm needing c.notes.
I get this error right now;
Msg 306, Level 16, State 2, Line 1
The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.
Sql Server 2005
select f.clientname,a.caseno,a.applid, a.applname,b.providerid, (a.status + ' / ' + a.statusreason)as Status, b.appt_datetime,max(c.adddttm) as RejectTime,c.notes
from VWA0 a with(nolock)
inner join VWAC f on
f.clientid = a.clientid
left outer join HHA b with(nolock)
on a.serial = b.appserial
and b.coid = f.clientname
and b.serial in
(select max(serial) from HHA with(nolock)
where appt_status in ('Appointment Complete','Appointment Rescheduled','Appointment Pending',
'Appointment Cancel')
group by appserial)
left outer join VWR c with(nolock)
on a.serial = c.appserial
and a.clientid = c.clientid
and c.notes like '% %'
and c.requirement = ('qc')
where a.status in ('corrections','returned by client','corrections submitted')
group by f.clientname,a.caseno,a.applid, a.applname,
b.providerid, (a.status + ' / ' + a.statusreason), b.appt_datetime,c.notes
I'm needing c.notes.
I get this error right now;
Msg 306, Level 16, State 2, Line 1
The text, ntext, and image data types cannot be compared or sorted, except when using IS NULL or LIKE operator.
Sql Server 2005
select f.clientname,a.caseno,a.applid, a.applname,b.providerid, (a.status + ' / ' + a.statusreason)as Status, b.appt_datetime,max(c.adddttm) as RejectTime,c.notes
from VWA0 a with(nolock)
inner join VWAC f on
f.clientid = a.clientid
left outer join HHA b with(nolock)
on a.serial = b.appserial
and b.coid = f.clientname
and b.serial in
(select max(serial) from HHA with(nolock)
where appt_status in ('Appointment Complete','Appointment Rescheduled','Appointment Pending',
'Appointment Cancel')
group by appserial)
left outer join VWR c with(nolock)
on a.serial = c.appserial
and a.clientid = c.clientid
and c.notes like '% %'
and c.requirement = ('qc')
where a.status in ('corrections','returned by client','corrections submitted')
group by f.clientname,a.caseno,a.applid, a.applname,
b.providerid, (a.status + ' / ' + a.statusreason), b.appt_datetime,c.notes