1 year ago

#386121

test-img

Jørn Vase

MYSQL - not distinct but eliminate

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?

mysql

select

union

distinct

sql-delete

0 Answers

Your Answer

Accepted video resources