Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add Column to End Report 1

Status
Not open for further replies.

Khanson82

MIS
Mar 5, 2010
85
US

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%')
 
1) use single quote
2) add column name
Code:
select  b.clientname,a.agency, a.applid,a.caseno, a.applname, a.status, a.statusreason,'During Scheduling' as mycolumn 
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%')

djj
The Lord is My Shepard (Psalm 23) - I need someone to lead me!
 
Wow..figured it be simple, but not that simple... Thanks again for your help..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top