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 the advantages of sql?
What are sql triggers used for?
what is primary key? : Sql dba
What if we write return in procedure?
How do I create an index in word?
What are sql built in functions?
What is duration in sql profiler trace?
How can you fetch first 5 characters of the string?
What does pl sql stand for?
What is a primary key sql?
What are the two characteristics of a primary key?
Is delete faster than truncate?
How do I debug a stored procedure?
What are tables and fields in the database?
what are the disadvantages of mysql? : Sql dba