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 / deepak

select source, destination, distance from Distance_rcd where source>destination
union select destination, source, distance from Distance_rcd where source<destination

Is This Answer Correct ?    1 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are transaction and its controls?

569


What are different types of statements supported by sql?

626


What are the different types of database management systems?

542


What is difference between pl and sql?

543


How can you know that statistics should be updated?

621






What is AUTH_ID and AUTH_USER in pl/sql ?

1705


What are the datatypes available in pl/sql ?

620


What is clustered index sql?

510


what is the stuff function and how does it differ from the replace function? : Sql dba

628


What is trigger explain it?

555


What does data normalization mean?

547


What is scalar data type in pl sql?

569


What are all the different normalizations?

593


How to run sql statements with oracle sql developer?

631


What are the types of index in sql?

543