资料形态:
希望算出USN栏位后面逗号分隔数据的sum值,期望结果是5.
 
SQL如下:
 
SELECT SUM(A)
  FROM (SELECT REGEXP_SUBSTR(sn, '[^,]+', 1, 2) AS a
           FROM INFO
          WHERE REGEXP_LIKE(sn, '[^,]+')
            AND ID = '5000012028'
            AND IDITEM = '20') b;