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 / nihar meher

select distinct greatest(source,destination),least(source,destination) from tablename;

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the maximum number of rows in sql table?

1034


What trigger means?

997


What is left join in postgresql?

1052


Does sql*plus have a pl/sql engine?

1081


Why we use stored procedure instead of query?

1007


Write a unique difference between a function and a stored procedure.

1009


What is the purpose of my sql?

960


What are the two characteristics of a primary key?

993


What are tables and fields in the database?

1122


What is the difference between python and sql?

1012


What is pl sql and why it is used for?

1120


How to return an array from java to pl/sql?

1149


how to check myisam tables for errors? : Sql dba

1326


How consistent is the view of the data between and within multiple sessions, transactions or statements ?

2229


How can the performance of a trigger be improved?

1050