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
Which command is used to delete a trigger?
What are tables in sql?
what are the differences between get and post methods in form submitting. Give the case where we can use get and we can use post methods? : Sql dba
What is the source code of a program?
Are stored procedures faster than dynamic sql?
How you can copy a file to file content and file to pl/sql table in advance pl/sql?
Does sql require a server?
Why sql query is slow?
What is a clob in sql?
What is a primary key called that is made up of more than one field?
What are pl sql procedures?
How you improve the performance of sql*loader? : aql loader
Which join is like an inner join?
What is the difference between syntax error and runtime error?
Explain character-manipulation functions?