Geeks Talk

Prepare for your Next Interview




Rerieve data from single column table

This is a discussion on Rerieve data from single column table within the SQL forums, part of the Databases category; Hi, I have a table called 'T1' in that i have column like 'Gender', in that column i have 'male' and 'female' values. How to retrieve count(male) and count(...


Go Back   Geeks Talk > Databases > SQL

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 02-15-2008
Junior Member
 
Join Date: Jan 2008
Location: banglore
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
sridevip_2008 is on a distinguished road
Rerieve data from single column table

Hi,
I have a table called 'T1' in that i have column like 'Gender', in that column i have 'male' and 'female' values. How to retrieve count(male) and count(Female) from T1.

Last edited by admin : 02-15-2008 at 07:23 AM.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 02-15-2008
Expert Member
 
Join Date: Sep 2007
Posts: 754
Thanks: 22
Thanked 64 Times in 63 Posts
krishnaindia2007 is on a distinguished road
Re: Rerieve data from single column table

Select sum (decode (sex,'male', 1,0)) MALE, sum (decode (sex,'female', 1,0)) FEMALE , count (decode (sex,'M', 1,'F', 1)) TOTAL from t1;
Reply With Quote
  #3 (permalink)  
Old 02-16-2008
Expert Member
 
Join Date: Apr 2007
Location: Bangalore
Posts: 447
Thanks: 20
Thanked 54 Times in 54 Posts
susarlasireesha is on a distinguished road
Re: Rerieve data from single column table

Try this one also
select gender,coun(*) from t1 group by gender;
Reply With Quote
Reply

  Geeks Talk > Databases > SQL


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
Add a new column to a table and insert values Ajit Kumar Maharatha Oracle 10 10-10-2008 09:59 AM
Extract the table name by using its column name Geek_Guest SQL 7 02-12-2008 09:26 AM
Hide column name in a table Geek_Guest Testing Issues 0 11-14-2007 12:35 AM
Writing new column and its value into the data table Geek_Guest WinRunner 0 08-12-2007 04:17 AM
Value of a single variable (column) into data table Geek_Guest QTP 1 07-09-2007 06:10 AM


All times are GMT -4. The time now is 05:52 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved