以下作品 - 当退单等于1时返回Y,否则默认为N
IF(fd.charge_back = 1, 'Y', 'N') AS charge_back
然而,我似乎无法让这个工作?语法是否有效
IF(compliment = ('set' OR 'Y' OR 1), 'Y', 'N') AS customer_compliment
答案 0 :(得分:67)
据推测这可行:
IF(compliment = 'set' OR compliment = 'Y' OR compliment = 1, 'Y', 'N') AS customer_compliment
答案 1 :(得分:7)
IF(compliment IN('set','Y',1), 'Y', 'N') AS customer_compliment
将按照Buttle Butkus的建议完成工作。