Unix Technical Forum

Several Conditional Count Columns

This is a discussion on Several Conditional Count Columns within the MySQL forums, part of the Database Server Software category; --> I am fairly new to SQL so please bare with me as I appreciate any help you all might ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-28-2008, 04:40 AM
Josh heep
 
Posts: n/a
Default Several Conditional Count Columns

I am fairly new to SQL so please bare with me as I appreciate any help
you all might offer. I have a applicant tracking database and I want
to pull a report with a job id, job title, and several counts of
candidates in various stages of interviews. What I do not know how to
do is to create the several columns of counted data for each job.

Ideal Output:

Job ID Job Title Stage 1 Stage 2 Stage 3 Stage 4
453 DBA 0 3 2 0
5623 .Net 14 2 0 0
134 CTO 0 0 2 2

etc.

Current Query:

Select Positions.Position_Id, Positions.Job_Title,
COUNT(Sendout_Records.Sendout_ID) As Interviews_Present
FROM Positions
Left Join Sendout_Records On Sendout_Records.Job_ID = Positions.Job_ID
Where (Positions.Status = 'A') AND (RIGHT(Positions.Position_ID,1) <>
'P')
Group By Positions.Position_ID, Positions.Job_Title

The field I want to check against in the count is
Sendout_Records.Status (Active - 0, Active - 1, Reject - 1, etc)

Thanks again for any help.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:54 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com