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
What is the maximum number of rows in sql table?
What trigger means?
What is left join in postgresql?
Does sql*plus have a pl/sql engine?
Why we use stored procedure instead of query?
Write a unique difference between a function and a stored procedure.
What is the purpose of my sql?
What are the two characteristics of a primary key?
What are tables and fields in the database?
What is the difference between python and sql?
What is pl sql and why it is used for?
How to return an array from java to pl/sql?
how to check myisam tables for errors? : Sql dba
How consistent is the view of the data between and within multiple sessions, transactions or statements ?
How can the performance of a trigger be improved?