0

From a SELECT I get this result:

u.id, c.id

101, 33
104, 57
105, 51

A UNION SELECT DISTINCT finds following records:

u.id, c.id

104, 57

The final result is:

u.id, c.id

101, 33
104, 57
105, 51

But I want the record from the UNION SELECT to eliminate the same record in the first select, so the result will be:

u.id, c.id

101, 33
105, 51

A UNION SELECT DISTINCT will only eliminate one of the two, so how to do it without a temp table?

  • Hi Jørn. could you write your table structure and the complete select? I don't think there is enough to go on in what you have included in your question – JoSSte Apr 07 '22 at 08:48
  • The question is not clear please read https://stackoverflow.com/help/how-to-ask – P.Salmon Apr 07 '22 at 09:27
  • BTW what's a union distinct? A UNION comes with implicit distinct on both tables party to the query – P.Salmon Apr 07 '22 at 09:29
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Apr 20 '22 at 04:09

0 Answers0