Help needed in AdventureWorks in a sql query.

Posted by vaibhav on Stack Overflow See other posts from Stack Overflow or by vaibhav
Published on 2009-12-23T17:20:49Z Indexed on 2010/04/28 15:13 UTC
Read the original article Hit count: 248

Filed under:
|
|
|

I was just playing with adventureworks database in sqlserver. I got stuck in a query. I wanted to Select all titles from HumanResources.Employee which are either 'Male' or 'Female' but not both. i.e if title Accountant is Male and Female both I want to leave that title. I need only those titles where Gender is either Male or Female.

I have done this till yet.

select distinct(title) from humanresources.employee where gender='M'
select distinct(title) from humanresources.employee where gender='F'

Probably a join between these two queries, would work. But If you have any other solution, please let me know.

It is not a homework. :)

Thanks in advance.

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about sql-server-2005