pattern matching - How to display this: row pair - column a value of one row is in column b of row 2 and column a value of second row is in column b of first row oracle? -
i have table of bus details. has bus_name, bus_source , bus_destination. need know bus pairs make return journey possible. eg.
bus_name | bus_source | bus_destination | chennai | bangalore b | bangalore | chennai c | mumbai | chennai
i expect this:
bus_name | bus_source | bus_destination | chennai | bangalore b | bangalore | chennai
use exists()
:
select * yourtable t exists(select 1 yourtable s t.bus_source = s.bus_destination , t.bus_destination = s.bus_source);
Comments
Post a Comment