Report query
- From: "c0de w via SQLMonster.com" <forum@xxxxxxxxxxxxxx>
- Date: Wed, 27 Jul 2005 19:28:42 GMT
I am trying to create a query which should return 4 columns
Facility | NoOfActiveApplicants | NoOfArchivedApplicants | TotalApplicants
I would be glad to even have just 3 columns since, the Total can be computed
in the display table (ColdFusion interface)
Facility | NoOfActiveApplicants | NoOfArchivedApplicants
So far I have the following query, which returns just 2 rows with both
NoOfActiveApplicants & NoOfArchivedApplicants under the same column.
Am stuck here, any help is apprecialted. Thanks in advance!
select
NoOfApplicants= sum(case when a.id <> 0 then 1 else 0 end)
, Facility = case when c.facility is null then c.JobDBFacilityName else c.
facility end
from tblapplicant a, tblJobDB b, tblfacilities c
where a.jobid = b.jobid
and b.facility = c.facilityid
group by c.facilityid,c.JobDBFacilityName,c.facility,b.facility
union all
select
NoOfApplicants= sum(case when a.id <> 0 then 1 else 0 end)
, Facility = case when c.facility is null then c.JobDBFacilityName else c.
facility end
from tblArchiveapplicant a, tblArchiveJob b, tblfacilities c
where a.JobVacancyNumber = b.JobVacancyNumber
and b.facility = c.facilityid
group by c.facilityid,c.JobDBFacilityName,c.facility,b.facility
order by facility
.
- Follow-Ups:
- Re: Report query
- From: jsfromynr
- Re: Report query
- From: Hugo Kornelis
- Re: Report query
- Prev by Date: Yukon XQuery question
- Next by Date: Scheduling a script
- Previous by thread: Yukon XQuery question
- Next by thread: Re: Report query
- Index(es):
Relevant Pages
|