Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How to change the order of columns in Oracle SQL Plus ?

1059


How do you rename a table in sql?

1123


What do you mean by rowid?

987


What are three advantages to using sql?

1027


What is the difference between Union and Union all. Which is faster.

1409


Explain what is a subquery ?

1194


What is the difference between microsoft access and sql server?

1069


What is a primary key example?

968


What is the difference between sql, mysql and sql server?

1114


How do I view a view in sql?

956


GLOBAL TEMPORARY TABLE over Views in advantages insolving mutating error?

3059


How many types of normalization are there?

971


What are the indexing methods?

1057


What do you understand by exception handling in pl/sql?

1040


what is the difference between $message and $$message? : Sql dba

1005