I have a table which has fields (id, parent_id, name, created_at). I want to write a query to select id, name, created_at, parent_created_at. The ‘parent_created_at’ is the ‘created_at’ field for the records matching parent (if it has one – i.e. the records parent_id >0), otherwise the ‘parent_created_at’ field should be null. Any suggestions?
Share
Self Join + ANSI SQL CASE Expression