MySQL - If It Starts With A Number Or Special Character

前端 未结 3 2101
独厮守ぢ
独厮守ぢ 2020-12-15 01:21
SELECT * 
FROM `thread` 
WHERE forumid NOT IN (1,2,3) AND IF( LEFT( title, 1) = \'#\', 1, 0)
ORDER BY title ASC

I have this query which will select

3条回答
  •  Happy的楠姐
    2020-12-15 02:05

    it's POSSIBLE you can try to cast it as a char:

    CAST('#' AS CHAR)
    

    but i don't know if this will work for the octothorpe (aka pound symbol :) ) because that's the symbol for starting a comment in MySQL

提交回复
热议问题