求助怎么才能查询出与01的b2值完全相同的b1呢?

解决方案 »

  1.   


    查询b1 条件是 b2完全等于01的b2
      

  2.   


    with t1(b1,b2)
     as (select  '01',1 from dual union 
     select '01',2 from dual  union
     select '02', 1 from dual union 
     select '02' ,2 from dual )
     select * from t1 where regexp_substr(b1,'[^0]+',1,1)=b2
    /*     B1 B2
    1 01 1
    2 02 2
    */
      

  3.   


    如果你的B1是varchar型的数字
    B2是number型的数字
    那就直接to_number B1然后和B2去做比较
      

  4.   

    select b1 from dual where dual in (select b2 from b where b1=01) 这样写呢
      

  5.   

    select b1 from dual where  b2 in (select b2 from dual where b1=01)
      

  6.   

    已知:a = [(4,2,3), (5, 9, 1), (7,8,9)]
    希望将二维列表转换成一维列表:["4,2,3", "5, 9, 1", "7,8,9"]>>> a = [(4,2,3), (5, 9, 1), (7,8,9)]
    >>> from itertools import chain
    >>> list(chain.from_iterable(a))
    [4, 2, 3, 5, 9, 1, 7, 8, 9]
    >>> from tkinter import _flatten   # python2.7也可以from compiler.ast import flatten
    >>> _flatten(a)
    (4, 2, 3, 5, 9, 1, 7, 8, 9)>>> [','.join(map(str,t)) for t in a]
    ['4,2,3', '5,9,1', '7,8,9']
    >>> from itertools import starmap
    >>> list(starmap('{},{},{}'.format,a))
    ['4,2,3', '5,9,1', '7,8,9']笨办法,提供一种思路
    a = [(4, 2, 3), (5,9,1), (7,8,9)]
    i=0
    while i<3:
        a[i]=str(a[i])[1:3*3-1]
        i=i+1
    print (a[0:3])>>> 
    ['4, 2, 3', '5, 9, 1', '7, 8, 9']