如题:TableA   有 afield,bfield 两个字段都是varchar(50), 如何显示TableA中 afield,bfield不同时为空的所有记录查询语句 如何写 ?

解决方案 »

  1.   

    select * from 表 
    where afield+bfield is not null
      

  2.   

    select *
    from tb
    where afield is not null or  bfield is not null
      

  3.   

    select *
    from TableA   
    where afield is not null or  bfield is not nullselect *
    from TableA   
    where afield is not null and bfield is not null
      

  4.   

    不为空: 我的意思是有数据即  null和' ',还有'' 都是空值
      

  5.   

    select * from 表 
    where isnull(afield,'')+isnull(bfield,'')<>''
      

  6.   

    select * from table1 where isnull(afield,'')<>'' or isnull(bfield,'')<>''