select * from table where ref like '%*'

解决方案 »

  1.   

    create table xh (uid varchar (10),ref varchar (50))insert into xh 
    select 'test','20   *'
    union
    select 'aa','15'select * from xh where ref like '%*'
      

  2.   

    1、ref>=21
    select * from [table] where ref<=21
    2、前4个
    select top 4 * from [table] 
    3、ref排序,前4个
    select top 4 * from [table] order by ref
    4、重复两个以上的前两个uid(条件uid+ref不重复)
    select * from [table] a
    where ref in (select top 2 ref from [table] where uid=a.uid order by ref)
    5、还是看楼主的条件吧
      

  3.   

    谢谢大家的回答,,但是后边还可能有
    test       21      *
     admin      21      *top 4是不行
      

  4.   

    看错了,否定了两个,第4个也否定了
    第一个还写错了,应该是
    1、ref<=21
    select * from [table] where ref<=21还是2、3楼厉害,一个创意,即没错也没否定
      

  5.   

    ref 不可能只是21的限制..我只是举了一个例子..   test       20      *
       admin      20      *
       test       21      *
       admin      21      *
       jerry      22   
       admin      22 
       test       23      * 
       admin      23      *
       
       .....      ...
       
    *不是字段..
      

  6.   

    select * from xh where rtrim(ltrim(ref)) like '%*'