I have a SQL table that looks something like this:
OP | ID | First name | Last name | Phone number |
---|---|---|---|---|
I | 123 | John | Smith | 888-555 |
U | 123 | 777-555 |
I have to combine this rows through select query into something like this:
ID | First name | Last name | Phone number |
---|---|---|---|
123 | John | Smith | 777-555 |
I have trouble writing query because my only idea is with MAX, but sometimes is field from U row lesser than the one in I row and I need to check every column.
What I tried:
Select ID,
max('First name') as 'First name',
max('Last name') as 'Last name',
max('Phone number') as 'Phone number'
from table
group by ID
Please help.