Consider a table with the structure of
id col1
WqDs.first
WqDs.second
eeRT.first
eeRT.second
How can I JOIN
the table to itself using the first part of the id
SELECT idxx, a.col1 AS First, b.col1 AS Second
FROM table1 a JOIN table1 b ON ....
idxx(temporary) First Second
WqDs
eeRT
I tried LIKE
but it works when an id exists in the id of another row. I thought to trim the first id of the first row and then find it in the second row, but there should be an easier way.
id
, make it 2 columns and use both columns in thePRIMARY KEY
.