急切询问如何写这个sql
mysql里表a 有字段 score, score是比分(值为 2:1,4:1,10:1 .......)现在我需要把 这个值取出来 (例如2:1)
分别取冒号前面的2, 和冒号后面的1,之后插入 2 和1 到表b的 front和 back字段里去。
如何用一个sql完成这个操作。
insert b (front ,back)
select?score? , ?score?from a
也就是如何找到对应的字符串处理函数。(oracle sqlserver比较简单)
在mysql没有字段串定位函数来做这个事情, 本帖最后由 liyihongcug 于 2009-6-17 14:35 编辑
select left(newValue, LOCATE(':', newValue)-1), right(newValue,LENGTH(newValue)-LOCATE(':', newValue) ),case when (operation='V') then 0 else 1 end
from SettlementLog where objType=1 and newValue is not null good
页:
[1]