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

What do you understand by pl/sql records?

1062


What is the trigger in sql?

1004


What is indexing oracle sql?

1150


How to run pl/sql statements in sql*plus?

1147


What is sql table?

1022


what are the non-standard sql commands supported by 'mysql'? : Sql dba

1176


What are the types pl/sql code blocks?

1197


What are the two types of cursors in pl sql?

1126


What is the most common sql injection tool?

1091


How do you optimize a query?

1060


How do you create a db file?

1069


What is the sql query to display the current date?

1094


Can I call a procedure inside a function?

1076


What is data type in database?

1043


What is dml statement?

1002