我寫了這個觸發更新基於客戶的收入列...觸發在MySQL中更新列中的值
CREATE TRIGGER `TRG_CUST_CODE` BEFORE INSERT ON `CUSTOMER_DIM`
FOR EACH ROW SET NEW.CUST_INCOME_AM = IF(NEW.CUST_INCOME_AM >= 55000, "H",
IF(NEW.CUST_INCOME_AM >= 40000 and NEW.CUST_INCOME_AM < 55000, "M",
IF(NEW.CUST_INCOME_AM >= 15000 AND NEW.CUST_INCOME_AM < 40000, "L","P"))
)
但是所有值都設爲P ...我失去的東西我在看?
給予一定的樣本數據 –
CUST_INCOME_AM 28000大號56000^h應該是這樣的事情小於15000應設爲P –