Suppose I have a table in an SQL database with many data , and some of the rows are almost identical, for example:
|===========================================|
| Message |
|===========================================|
| ... |
|-------------------------------------------|
| account is rejected: <aa> |
|-------------------------------------------|
| account is rejected: <bb> |
|-------------------------------------------|
| mailbox unavailable: 550 550 <1@b.com> |
|-------------------------------------------|
| mailbox unavailable: 550 550 <2@b.com> |
|-------------------------------------------|
| ... |
for my purposes, the 2 first lines are identical and the last two lines are identical, so the query should return
- account rejected:
- Mailbox not available: 550 550
I thought to write a query that will select strings, exclude characters after the '<' sign and will do DISTINCT, but I do not know how to do it all inSELECT
Can you help me write such a request?
source
share