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
Answer Posted / prativa mishra
select range distance,count(range) no_of_city
from
(SELECT cityname,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 CITY1)
group by range
Is This Answer Correct ? | 20 Yes | 2 No |
Post New Answer View All Answers
What are all different types of collation sensitivity?
How can you tell the difference between an index and a view?
How to look at the current sql*plus system settings?
What is %type in sql?
What is PL/SQL Records?
What does 0 mean in sql?
What is the difference between joins?
how to get a list of columns in an existing table? : Sql dba
Advantages and disadvantages of stored procedure?
What is application trigger?
How much does a sql dba make? : SQL DBA
what are the different type of sql's statements ? : Sql dba
What is a clob in sql?
What is set transaction?
What is a table partition?