Can someone explain what the FOR is doing in this query as I have never seen this usage before in MySQL
SELECT SUBSTR(
url FROM 1 FOR IF( LOCATE('/', url, 9)!= 0, LOCATE('/', url, 9) - 1, LENGTH(url) )
) AS justurl FROM DUAL;
Can someone explain what the FOR is doing in this query as I have never seen this usage before in MySQL
SELECT SUBSTR(
url FROM 1 FOR IF( LOCATE('/', url, 9)!= 0, LOCATE('/', url, 9) - 1, LENGTH(url) )
) AS justurl FROM DUAL;
一位同事指出了我哪里出错了,我错过了 SUBSTR 允许您在其中编写 FROM 和 FOR 的事实。阻止这些 4GL 语言。
SUBSTR(str FROM pos FOR len)
http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_substr