Here is my code
select coreid,giftamount,addr1,addrcity
from
coretable left outer join gifttable on coreid=giftid
left outer join addrtable on coreid=addrid
select jobsid
from jobstable
left outer join coretable on coreid = jobsid
where jobtype = 'desc'
select schoolid
from schooltable
left outer join coretable on coreid = schoolid
where degree = 'MD'
The only thing common in each query is all must have a coreid.
I also want a case statement that totals the giving such as this
sum(case when giftacct = 'M5' and giftdate >= '7/1/2005 'then giftamount else 0 end)as Giving
Essentially there are three different queries that must be combined into one union query. Any ideas on how to approach this???
Example Output
coreid 01225
addr1 125 State Street
addrcity Williamsburg
degree MD
amount(from case statement) 2500
jobtype desc
select coreid,giftamount,addr1,addrcity
from
coretable left outer join gifttable on coreid=giftid
left outer join addrtable on coreid=addrid
select jobsid
from jobstable
left outer join coretable on coreid = jobsid
where jobtype = 'desc'
select schoolid
from schooltable
left outer join coretable on coreid = schoolid
where degree = 'MD'
The only thing common in each query is all must have a coreid.
I also want a case statement that totals the giving such as this
sum(case when giftacct = 'M5' and giftdate >= '7/1/2005 'then giftamount else 0 end)as Giving
Essentially there are three different queries that must be combined into one union query. Any ideas on how to approach this???
Example Output
coreid 01225
addr1 125 State Street
addrcity Williamsburg
degree MD
amount(from case statement) 2500
jobtype desc