Display MySQL columns into Rows- phpmyAdmin

SELECT

r0.unit_model,

r0.tab_type,

r1.title_en AS “H1_EN”,

r2.title_en AS “H2_EN”,

r3.title_en AS “H3_EN”

FROM

(SELECT DISTINCT

unit_model, title_en ,tab_type

FROM

unit_models_copy

WHERE  tab_type=’hl’ AND (unit_model=’5051′ OR unit_model=’5052′ OR unit_model=’5064′)

 

) r0

LEFT JOIN unit_models_copy r1

ON r1.unit_model = r0.unit_model   AND r1.tab_type=’hl’ AND r1.`ranking`=’1′

LEFT JOIN unit_models_copy r2

ON r2.unit_model = r0.unit_model  AND r2.tab_type=’hl’ AND r2.`ranking`=’2′

LEFT JOIN unit_models_copy r3

ON r3.unit_model = r0.unit_model  AND r3.tab_type=’hl’  AND r3.`ranking`=’3′

 

GROUP BY unit_model