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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

selecting....

Status
Not open for further replies.

saina

Programmer
Jan 19, 2006
8
US
I have the following query

select oc_name,a.BUSINESS_TITLE_DESCR,count( a.sex) F
from ws_sps_ee a,ws_sps_dept b
where a.deptid=b.deptid and a.BUSINESS_TITLE_DESCR in ('First Vice President','Vice President','Senior Vice President')and a.sex in('F')
group by oc_name,a.BUSINESS_TITLE_DESCR,a.sex
order by oc_name

i need to get the count of people who hold a particular businees title and how many of them are female and how many are male under oc_name.


can anyone help me?
 
Code:
select oc_name
     , a.BUSINESS_TITLE_DESCR
     , a.sex        as gender 
     , count(a.sex) as gender_count
  from ws_sps_ee a
inner
  join ws_sps_dept b
    on a.deptid=b.deptid 
 where a.BUSINESS_TITLE_DESCR 
    in ('First Vice President'
       ,'Vice President'
       ,'Senior Vice President')
group 
    by oc_name
     , a.BUSINESS_TITLE_DESCR
     , a.sex
order 
    by oc_name

r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top