0

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;
4

1 回答 1

0

一位同事指出了我哪里出错了,我错过了 SUBSTR 允许您在其中编写 FROM 和 FOR 的事实。阻止这些 4GL 语言。

SUBSTR(str FROM pos FOR len) 

http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_substr

于 2013-04-05T07:41:13.777 回答