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
Is stored procedure faster than query?
How to rename a table?
Can we commit in trigger?
Can we join 3 tables in sql?
How can you fetch common records from two tables?
Can a foreign key be null?
What is rowid in sql?
Explain locks? : Transact sql
how would you write a query to select all teams that won either 2, 4, 6 or 8 games? : Sql dba
What are the types of operators available in sql?
What is sqlite used for?
What does the sign mean in sql?
what are the 'mysql' command line options? : Sql dba
What is difference between nchar and nvarchar?
what is online transaction processing (oltp)? : Sql dba