Multiple IF statements on MYSQL
问题 I'm trying to Display somes values in my database result, I am using this code but I can not succeed: SELECT item_code, IF(category_code = 'HERR1', 'NO', 1) OR (category_code = 'COLN5', 'NO', 2) AS category_code, item_name, item_quantity FROM qa_items EDIT : I Want to display for example: If category_code = 'HERR1' Display = 1 else if category_code = 'COLN5' Display = 2 End If If anyone has any idea, would greatly appreciate it 回答1: I'd rather use CASE : SELECT item_code, CASE category_code