You can use a case statement in SQL like so:
SELECTid, `name`, title,CASE idWHEN 2 THEN 1WHEN 3 THEN 1ELSE 0END AS selectedCaseFROM table