Answer the question
In order to leave comments, you need to log in
How to exclude duplicates from two columns (SQL)?
There is a table (mails):
| id | to | from | ... |
You need to select from mail only those where the values of both to and from are not repeated, i.e. for table
| id | to | from |
| 1 | 1 | 2 |
| 2 | 2 | 1 |
| 3 | 1 | 3 |
| 4 | 3 | 1 |
| 5 | 1 | 3 |
result
| id | user1 | user2 |
| 1 | 1 | 2 |
| 3 | 1 | 3 |
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question