我有這個疑問多個條件:MySQL的SUBSTRING在WHERE子句
SELECT DISTINCT phone, department
FROM `users`
WHERE ((SUBSTRING(phone,1,3) = '399')
AND (SUBSTRING(phone,5,4) BETWEEN '3400' AND '3499')
OR (SUBSTRING(phone,1,3) = '244')
AND (SUBSTRING (phone,5,4) BETWEEN '5400' AND '5499'))
,讓我這個錯誤:
#1630 - FUNCTION Database.SUBSTRING does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
的查詢工作,如果我只能用這個:
SELECT DISTINCT phone, department
FROM `users`
WHERE (SUBSTRING(phone,1,3) = '399')
AND (SUBSTRING(phone,5,4) BETWEEN '3400' AND '3499')