Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I run a pl sql program?

1191


Explain table and field in sql?

1117


What is right join in sql?

1157


Explain the steps needed to create the scheduled job?

1091


Is it possible to sort a column using a column alias?

1100


What are the two characteristics of a primary key?

1031


What is varchar used for?

1138


Why do we create views in sql?

1217


Is sql the best database?

1027


What is the use of stored procedures?

1105


What is coalesce sql?

1056


How to fetch alternate records from a table?

1305


difference between anonymous blocks and sub-programs.

1188


What is primary key and foreign key?

1014


what is the difference between delete and truncate commands? : Sql dba

1119