0

I am querying a booking table to see if I have a Resource Clash. The query joins to the same table twice similar to this answer:

https://stackoverflow.com/a/2727467/578451

However I get duplicate results returned

i.e. Booking 1 Clashes with Booking 2 & Booking 2 Clashes with Booking 1:

2 records returned..

booking_1_id|booking_2_id
1           |2
2           |1

Somehow I need to remove one of the (near) duplicates. GROUP BY is not enough.

Ideas?

Community
  • 1
  • 1
JPC
  • 71
  • 1
  • 9

1 Answers1

1
SELECT * FROM (

-- your complete query here

) AS baseview
WHERE booking_1_id<booking_2_id;
Eugen Rieck
  • 64,175
  • 10
  • 70
  • 92