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 scalar function?
How many columns should be in an index?
Can you join views in sql?
What are the different types of triggers?
ERROR:Insert or update on table"accnt" violates foreign key constraints "acct_to_curr_symbol" DETAILS:KEY(accnt_curr_id)(-2)is not present in the table "curr_symbol" ......solve The Problem..
What is sql and explain its components?
How does join work in sql?
what is the difference between mysql_fetch_object and mysql_fetch_array? : Sql dba
what is the difference between inner and outer join? Explain with example. : Sql dba
Why self join is used in sql?
Write a query to display the current date in sql?
How do I trace sql profiler?
Does truncate require commit?
What are the different types of database management systems?
Explain what is a column in a table?