Prefiro usar
CASE
:SELECT item_code,
CASE category_code
WHEN 'HERR1' THEN 1
WHEN 'COLN5' THEN 2
ELSE 'NO'
END as category_code, item_name, item_quantity
FROM qa_items
Mas
IF
também funcionará:IF(category_code='HERR1',1, IF(category_code='COLN5',2,'NO'))