DQL, jeśli lub ifNull
case when c.type_id = 9 then c.name else c.lastname end as name
Rich Raccoon
case when c.type_id = 9 then c.name else c.lastname end as name