If I want to just add a column to the output of this report to say "during scheduling" for every value, basically so I can pivot off this field later, how would you do it? All I can find is alter table and add column ref. but that is not really what I'm trying to do I don't think..
select b.clientname,a.agency, a.applid,a.caseno, a.applname, a.status, a.statusreason,"During Scheduling" from vap0 a inner join vac0 b with(nolock) on a.clientid = b.clientid
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 vre0 c with(nolock) where c.requirement = 'appointment pending'
group by c.clientid, c.appserial)
and (a.status like '%cancel%' or a.statusreason like '%cancel%')