我有一张表其中一个字段的内容类似这样子的,如(列举三个内容)189,1453,9;1892,1432,132;1762,329,3212
现在我想根据最后面那些数字来删除如:1892,1432,132  我想根据132    1762,329,3212我想根据3212  请问这样的语句怎么实现?谢谢了

解决方案 »

  1.   

    这个好像可以用charindex实现?
      

  2.   

    create table tb(col nvarchar(20))
    insert into tb select '189,1453,9'
    insert into tb select '1892,1432,132'
    insert into tb select '1762,329,3212'
    go
    delete from tb where right(col,charindex(',',REVERSE(col))-1) in(132,3212)
    select * from tb
    /*
    col
    --------------------
    189,1453,9(1 行受影响)*/
    go
    drop table tb