how to achieve this problem?i am having table with two
colums like empno,gender.
in gender column, i am having records male,female like that
.my final output will be
male female
5 6
Answers were Sorted based on User's Feedback
Answer / shivaindu
SQL> select sum(decode(gender, 'male', 1)) as Male,
sum(decode(gender, 'female', 1)) as Female from
emp1;
MALE FEMALE
---------- ----------
9 7
Is This Answer Correct ? | 16 Yes | 1 No |
Answer / jayakrishnan
select count(case gender when 'male' then 1 end) Male,
count(case gender when 'female' then 1 end) Female from emp1
Is This Answer Correct ? | 5 Yes | 1 No |
Answer / sudeep ranjan
select gender,count(gender)as gender_count from emp group
by gender;
Is This Answer Correct ? | 5 Yes | 1 No |
Answer / venkat
select Count(gender) from emp group by gender with rollup
Is This Answer Correct ? | 1 Yes | 0 No |
What are the PL/SQL Statements used in cursor processing ?
What is difference between cursor and trigger?
What is the difference between function, procedure and package in pl/sql?
What is the full form of sql?
What are the different parts of a package?
Why do we need pl sql?
What are the steps for performance tuning.
Can I join the same table twice?
There is a table, In one column it has implemented a index, but the index is disturbed by the regular dml statements.. but still we need to keep the index. how it is possible?
how to use in conditions? : Sql dba
How do I view stored procedures?
How to fetch values from testtable1 that are not in testtable2 without using not keyword?