where binary ucase(title) like concat('%',ucase('a'),'%')
檢索的步驟是先將屬性指定為 BINARY ,以精確檢索結果,而被 like 的 title內容存在大小寫字母的可能,故先使用 ucase 函數將字段內容全部轉換成大寫字母,然后再進行 like 操作,而 like 的操作使用模糊方法,使用 concat的好處是傳進來的可以是直接的關鍵字,不需要帶“%”萬用符,將“'a'”直接換成你的變量,在任何語言下都萬事無憂了。 當然你也可以這么寫:
Code: select id,title,name from achech_com.news where binary ucase(title) like ucase('%a%')