I have this existing query
Select
mt.First_name,
mt.Last_name as OLD_Last_name,
ot.Last_name as New_Last_name,
ot.Date as Update_Date,
from maintable as mt
JOIN othertable as ot on mt.id=ot.id
I'd like to join a new column with the following output: [mt.First_name] [ot.Last_name], nee [mt.Last_name] changed their name on [ot.Date]. I tried using a case statement but didn't get it right.
SELECT mt.First_name || ' ' || ot.Last_name || ', nee ' || mt.last_name || ' changed their name on ' || ot.Date AS yournewcolumn, mt.First_name, mt.Last_name as OLD_Last_name, ot.Last_name as New_Last_name, ot.Date as Update_Date from maintable as mt JOIN othertable as ot on mt.id=ot.id