Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> How to calculate the total of a varchar column?
Hello,
I have a column named Gender in my table. Its a varchar2 type column and each row is either 'M' or and 'F'. I want to count the no. of Ms and number of Fs and obtain the result of the number of Ms and Fs in a separate row.
Right now I am only able to perform the count function and obtain the number of Ms and Fs. But I am not able to get the total for Ms and Fs. So can some one please tell me how should I do it?
Right now I am giving the following command:
SELECT GENDER, COUNT(GENDER) As American_Indian
FROM STUDENT_DETAIL
WHERE ETHNIC_GROUP_CODE = 1
GROUP BY GENDER ORDER BY GENDER DESC
And the output is coming as
Gender American_Indian
M 60 F 60
What I want to see is
Gender American_Indian
M 60 F 60 MF 120
Please help.
Thank you.
Krishna. Received on Mon Feb 13 2006 - 10:09:52 CST