我想问一下,一个表中有用户名username怎样根据用户名进行模糊查询,
sql怎样写???!!

解决方案 »

  1.   

    select * from 表名 where username like '%关键字%'
      

  2.   


    select * from table where charindex(关键字,username)>0
      

  3.   


    1  select * from tb where username like '%关键字%'
    2  select * from tb where charindex(关键字,username)>0
      

  4.   

    --1
    select * from tb where username like '%关键字%'
    --2
    select * from tb where charindex('关键字',username)>0
    --3
    select * from tb where PATINDEX('%关键字%',username)>0