Hi! Could we please enable some services and cookies to improve your experience and our website?

SQLize | PHPize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

A A A
Login    Share code      Blog   FAQ
Copy Format Clear
Select Emplid coalesce(max(case when name_type = 'PRF' then NAME END),MAX(Case when name_type = 'PRI' THEN NAME END)) as NAME, max(case when name_type = 'PRI' then Name END) as PRI_NAME FROM( SELECT PRI.Emplid ,PRI.Name_Type ,PRI.Name From ps_names PRI WHERE PRI.name_type = 'PRI' UNION SELECT PRF.Emplid ,PRF.Name_Type ,PRF.Name From ps_names PRF WHERE PRI.name_type = 'PRF' Group by Emplid;

Stuck with a problem? Got Error? Ask AI support!

Copy Clear