source destination distance
chennai bangalore 500
bangalore chennai 500
hyd delhi 1000
delhi hyd 1000
bangalore hyd 800
Here chennai to bangalore and bangalore to chennai is same distance. and hyd and delhi also same criteria.
Based on the distance i want to display only one row using sql query?
Answer Posted / sushma ajay
select source, destination, distance from(
select source,destination,lag(source) over (order by distance) oldsrc,distance
from traveldist)
where nvl(destination,'@') <> nvl(oldsrc,'@');
| Is This Answer Correct ? | 5 Yes | 6 No |
Post New Answer View All Answers
What do you understand by pl/sql records?
What is the trigger in sql?
What is indexing oracle sql?
How to run pl/sql statements in sql*plus?
What is sql table?
what are the non-standard sql commands supported by 'mysql'? : Sql dba
What are the types pl/sql code blocks?
What are the two types of cursors in pl sql?
What is the most common sql injection tool?
How do you optimize a query?
How do you create a db file?
What is the sql query to display the current date?
Can I call a procedure inside a function?
What is data type in database?
What is dml statement?