The field "d.dttime" is coming back null and it should have a date. Any ideas why it's not working?
Sql Server 2005 Management Studio Express
select b.clientname,a.agency, a.applid,a.caseno,d.dttime,a.applname, a.status, a.statusreason,'During Scheduling' as SchedulingProcess
from vwapp0 a
inner join VWAC b with(nolock)
on a.clientid = b.clientid
left outer join VWAP d with(nolock)
on a.serial = d.appserial
and d.clientid = a.clientid
and d.serial in (select max(serial) from VWAP with(nolock)
where status in ('%cancel%') or statusreason in('%cancel%')
group by appserial)
where (Convert(varchar(8000),a.clientid) + '-' + Convert(varchar(8000),a.serial))
not in ( select distinct (Convert(varchar(8000),c.clientid) + '-' + Convert(varchar(8000),c.appserial)) from VWR0 c with(nolock) where c.requirement = 'appointment pending'
group by c.clientid, c.appserial)
and (a.status like '%cancel%' or a.statusreason like '%cancel%')
Sql Server 2005 Management Studio Express
select b.clientname,a.agency, a.applid,a.caseno,d.dttime,a.applname, a.status, a.statusreason,'During Scheduling' as SchedulingProcess
from vwapp0 a
inner join VWAC b with(nolock)
on a.clientid = b.clientid
left outer join VWAP d with(nolock)
on a.serial = d.appserial
and d.clientid = a.clientid
and d.serial in (select max(serial) from VWAP with(nolock)
where status in ('%cancel%') or statusreason in('%cancel%')
group by appserial)
where (Convert(varchar(8000),a.clientid) + '-' + Convert(varchar(8000),a.serial))
not in ( select distinct (Convert(varchar(8000),c.clientid) + '-' + Convert(varchar(8000),c.appserial)) from VWR0 c with(nolock) where c.requirement = 'appointment pending'
group by c.clientid, c.appserial)
and (a.status like '%cancel%' or a.statusreason like '%cancel%')