I have a table set up as follows
id
origin
destination
carrier_id
so typical row could be,
100: London Manchester 366
Now each route goes both ways, so there shouldn’t be a row like this
233: Manchester London 366
since that’s essentially the same route (for my purposes anyway)
Unfortunately though, i have wound up with a handful of duplicates. I have over 50,000 routes made up of around 2000 point of origin (or destination, however you want to look at it) in the table. So i’m thinking looping through each point of origin to find duplicates would be insane.
So I don’t even know where to start trying to figure out a query to identify them. Any ideas?
I think you just need a double join, the following will identify all the “duplicate” records joined together.
Here’s an example.
Say
SELECT * FROM FLIGHTSyielded:So there’s a bunch of duplicates (4 of the routes are duplicates of some other route).
would yield just the duplicates:
At that point you just might delete all the ones that occurred 1st.
Good luck!