I have a table:
Table1
fname lname job education
----------------------------------------
john doe dentist harvard
john doe dentist mit
eric doyle lawyer mit
anna johnson nurse yale
Trying to select all columns
select fname, lname, job, education
from table1
But this returns output like
john doe dentist harvard
john doe dentist mit
eric doyle lawer mit
anna johnson nurse yale
How can I make it like this:
john doe dentist harvard, mit
eric doyle lawer mit
anna johnson nurse yale
In other words the same person "john doe", education is concatenated into one column with one row.
Was thinking to write a Python script that:
- Read column 1,column 2 and other column except the last one, stores the values
- Check if 2nd row column1 and column2 is different or the same
- If the same, read column 4 from 1 row and 2 row and concat it into the string
- Update the 4 column to have concatenated value
- if different, go further
Need some tips! Thanks in advance.