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 -> Re: How to calculate the total of a varchar column?

Re: How to calculate the total of a varchar column?

From: Krishna <mpkrishna25_at_yahoo.com>
Date: 15 Feb 2006 15:08:31 -0800
Message-ID: <1140044911.332349.77810@g44g2000cwa.googlegroups.com>


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

Original text of this message

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