Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to calculate the total of a varchar column?
Hi,
Thanks a lot all for your help. Now I need to interchange the output
slightly.
Instead of this
Gender American_Indian
M 60 F 60 MF 120
I want the output as
Race Male Female
Race 1 60 60 Race 2 70 50
I am getting it separately for each column but I am not able to show Male and Female as 2 separate columns.
I've tried the following:
SELECT DISTINCT
DECODE(GENDER, 'M',
COUNT(GENDER),NULL) MALE
FROM STUD_DTL
GROUP BY GENDER;
Not executing giving errors
SELECT COUNT(GENDER) MALE and COUNT(GENDER) FEMALE FROM STUD_DTL WHERE GENDER = 'M' AND GENDER = 'F' ORDER BY GENDER; SELECT COUNT(GENDER) MALE, COUNT(GENDER) FEMALE FROM STUD_DTL WHERE GENDER = 'M' AND GENDER = 'F' ORDER BY GENDER; None of the above commands is working. Can you please help me?
Thank you.
Krish. Received on Wed Feb 15 2006 - 17:08:31 CST