SELECT id AS kid, NAME, IF (t1.kpi, t1.kpi, 0) AS kpi, t1.sort, STATUS, t1.kpi_idFROMform_kpi_nameLEFT JOIN ( SELECT kpi_id AS i, kpi, sort, username, id AS kpi_id FROM faw_form_kpi WHERE username = '123') AS t1 ON form_kpi_name.id = t1.iWHEREform_kp…