• + 1 comment

    EASIEST SOLUTION mY SQL


    with doctor as ( select name, ROW_NUMBER() OVER(order by name) as rn from OCCUPATIONS where occupation LIKE 'Doctor' ) , professor as ( select name, ROW_NUMBER() OVER(order by name) as rn from OCCUPATIONS where occupation LIKE 'Professor' ) ,singer as ( select name, ROW_NUMBER() OVER(order by name) as rn from OCCUPATIONS where occupation LIKE 'Singer' ) , actor as ( select name, ROW_NUMBER() OVER(order by name) as rn from OCCUPATIONS where occupation LIKE 'Actor' )

    SELECT d.name, p.name, s.name, a.name FROM professor p LEFT JOIN doctor d on d.rn = p.rn LEFT Join singer s on s.rn = p.rn LEFT JOIN actor a on a.rn = p.rn