Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> How to calculate the total of a varchar column?

How to calculate the total of a varchar column?

From: Krishna <mpkrishna25_at_yahoo.com>
Date: 13 Feb 2006 08:09:52 -0800
Message-ID: <1139846992.606755.128210@g47g2000cwa.googlegroups.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US