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 / janani
select '0-50' distance, count(*) No.ofcity from table
where mails between 0 and 50
union
select '51-100' distance, count(*) No.ofcity from table
where mails between 51 and 100
union
select '101-150' distance, count(*) No.ofcity from table
where mails between 101 and 150
| Is This Answer Correct ? | 5 Yes | 1 No |
Post New Answer View All Answers
Under what condition it is possible to have a page level lock and row lock at the same time for a query? : Transact sql
What do you know by pl/sql cursors?
What are stored procedures used for?
what are the advantages and disadvantages of views in a database? : Sql dba
How many scalar data types are supported in pl/sql?
what is online transaction processing (oltp)? : Sql dba
is it possible to pass an object or table to a procedure as an argument?
What are few of the schema objects that are created using PL/SQL?
a table has 2 classifications 1)liabilities 2)earnings this liabitity has 2 elements with 2 input values and the earnings have 2 elements with 2 input values i wrote a query so that my input is liability savings amount1 amount2 xxxx null xxxxxx 0 xxx1 null xxxxx1 0 null yyyy 0 yyyy null yyy1 0 yyy1 my problem is --when i developed a report(d2k) with this data my o/p is liabilities,amount1,savings,amount2 xxxx xxxxxx xxx1 xxxxx1 yyyy yyyy yyy1 yyy1 how could i move this savings,savings values 2 palces up. can any body provide me witha better solution
What are the various levels of constraints?
what is the difference between primary key and unique key? : Sql dba
How to call a javascript function from pl sql?
Explain the the delete statements in sql?
Differentiate between syntax and runtime errors.
Define select, insert, create, delete, update, drop keywords