喜網絡的好人,PHP在MySQL查詢
假設我有此查詢
$query ="select col1, col2 From table where condition";
我想獲得COL2
$DLMPos = strpos(col2, '-DLM');
if($DLMPos != "" && $DLMPos >= 0){
$col2= strpos(substr(col2, $DLMPos, strlen(col2)), " ");
}
的值以下運行問題:有沒有什麼辦法可以在查詢 中包含這個處理==> $ query =「select col1,if(bla bla bla)From table where condition」;.
我知道我們可以做如果在MySQL查詢語句,但我們可以做像strpos和substr的東西?
在此先感謝