给定表data
如下:
<表类>
id
a1
a2
a3
tbody><<tr>1 b 300 10 2c 111 12 3 b 300 10 4b 300 10 表类>
作为笑话:
SELECT t1.id, t2.id
FROM data t1
JOIN data t2 ON (t1.a1, t1.a2, t1.a3) <> (t2.a1, t2.a2, t2.a3)
LIMIT 1
如果某些列可能为NULL,则
SELECT t1.id, t2.id
FROM data t1
JOIN data t2 ON NOT ((t1.a1, t1.a2, t1.a3) <=> (t2.a1, t2.a2, t2.a3))
LIMIT 1