mysql> select substring_index('0502AR18(K001)','(',1);
+-----------------------------------------+
| substring_index('0502AR18(K001)','(',1) |
+-----------------------------------------+
| 0502AR18                                |
+-----------------------------------------+
1 row in set (0.06 sec)
SUBSTRING_INDEX(str,delim,count) Returns the substring from string str before count occurrences of the delimiter delim. If count is positive, everything to the left of the final delimiter (counting from the left) is returned. If count is negative, everything to the right of the final delimiter (counting from the right) is returned. SUBSTRING_INDEX() performs a case-sensitive match when searching for delim. mysql> SELECT SUBSTRING_INDEX('www.mysql.com', '.', 2);
        -> 'www.mysql'
mysql> SELECT SUBSTRING_INDEX('www.mysql.com', '.', -2);
        -> 'mysql.com'This function is multi-byte safe. 

解决方案 »

  1.   

    非常感谢上面大侠的帮助,问题已经解决,但还有一个问题,请再帮帮.小弟现在繁体系统下,用VB6.0+My SQL开发了一个程序,但在对一个Recordset对象作.MoveLast操作时,出现如下错误:
    run-time error '-2147467259(80004005)';
    资料提供者或其它服务回传电子邮箱状态.不知上述错误产生的原因是什么,要怎么避免呢?对这个Recordset对象作.MoveFrist,.MoveNext等操作都正常.
      

  2.   

    这个我就不清楚了,上面的错误好像不是MySQL的错误代码来的,我对VB一点也不会,所以帮不了你,望楼下的高手帮你解决吧。