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...

i have a table like this.

cityno cityname mails
1 BANGALORE 8KM
2 HSR LAYOUT 20KM
3 MEJISTIC 30KM
4 JAYADEVA 55KM
5 ITPL 80KM
6 HEBBAL 115KM

I HAVE DATA LIKE THIS

I WANT O/P LIKE THIS
DISTANCE NO.OFCITY
0-50KM 3
51-100KM 2
101-150KM 4

AND SO ON

pls give me answer. i want urgent

Answer Posted / prasant kumar sahoo

Answer in Horizontal out put
select RANGE distance,count(range) no_of_city
from
(SELECT citiname,mails,
CASE WHEN MAILS BETWEEN 0 AND 50 THEN '0-50'
WHEN MAILS BETWEEN 51 AND 100 THEN '51-100'
ELSE '101-150'
END RANGE
FROM test1)
group by range;

Is This Answer Correct ?    6 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is normalization? How many normalization forms are there?

1009


Can you do multiple joins in sql?

969


What is cursor and why it is required?

1105


what does it mean to have quoted_identifier on? What are the implications of having it off? : Sql dba

944


How many sql statements are used?

960


How do I view output in sql developer?

1026


what is the difference between ereg_replace() and eregi_replace()? : Sql dba

1071


How do I run pl sql in sql developer?

1058


Are null values same as that of zero or a blank space?

966


what is a stored procedure? : Sql dba

1051


What is embedded sql in db2?

955


What is sqlite format?

1107


what is sql in mysql? : Sql dba

1120


how can you see all indexes defined for a table? : Sql dba

933


How do I write a cron which will run a sql query and mail the results to agroup?

910