Help with a query.

  • Thread starter Thread starter touf
  • Start date Start date
T

touf

I've a table (Access 2000) that contains these 3 firlds:
- name
- type(string) = "man" or "woman"
- Salary (double)

I need to create an SQL query that return me the folowing result

name man woman
----- ----- -----
aaaa 10 0
bbbb 12 0
cccc 0 11
dddd 15 0

means: aaaa,bbbb and dddd are men, and cccc is a woman

I need one query' text because I kave to pass it as parameter to a
function.

Thanks.
 
Ahlan touf

Try This

SELECT Name, Salary AS Man, 0 AS Woman WHERE Type = 'man'
UNION
SELECT Name, 0 AS Man, Salary AS Woman WHERE Type = 'woman'
ORDER By Name

This should give you the results you desire

Ibrahim
 
Thanks.

IbrahimMalluf said:
Ahlan touf

Try This

SELECT Name, Salary AS Man, 0 AS Woman WHERE Type = 'man'
UNION
SELECT Name, 0 AS Man, Salary AS Woman WHERE Type = 'woman'
ORDER By Name

This should give you the results you desire

Ibrahim
 
Back
Top