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
Here I am giving the query in SQL in Vertical Out put
----------------------------------------------
select * from (select (select count(*) from (select
count(citino) from test1 where mails between 0 and 50 group
by citino) t1) as "0-50",
(select count(*) from (select count(citino) from test1 where
mails between 51 and 100 group by citino) t2) as "51-100",
(select count(*) from (select count(citino) from test1 where
mails between 101 and 150 group by citino) t3) as "101-150"
from test1) "Result" where rownum=1;
---------------------------------------------------
if u want to Horizontal out put it need an another table
that store the range like 0-50,51-100 like. And then U just
Join this it so easy. If you need then, mail me
---------------------------------------------
if you need in Plsql also mail me I will send you
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
what are string data types? : Sql dba
what is the syntax used for partition in tsql? : Transact sql
Does sql view stored data?
When a dml statement is executed, in which cursor attributes, the outcome of the statement is saved?
What are inbuilt functions in sql?
How to disable a trigger name update_salary?
what are wild cards used in database for pattern matching ? : Sql dba
Is t sql a programming language?
What is the file extension for sql database?
What is java sql connection?
Why do we use sql constraints? Which constraints we can use while creating database in sql?
What is mdb stand for?
What are the different types of dbms?
Define commit, rollback and savepoint?
How consistent is the view of the data between and within multiple sessions, transactions or statements ?