Skip to content
Advertisement

Eliminate the rows that becomes same after swapping as in original table in SQL Server

I have a table which contains data as follows:

I want a table which do not have Mumbai—>Jaipur as it is present already before being swapped. Similarly, Lucknow—>Indore is not required. All other entries must come as it is which is there in the existing table.

Can any body help.

Note: Table must not have any id or S.No. in the table.

Advertisement

Answer

You can create a view or use select statement with not exists to prevent duplicate journey :

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement