GBACK字段为BIT类型,里面有几个NULL和TRUE的值但是用select C_PART from DPSALES where GBACK<>1得不到那些不为真的数据,请帮忙,谢谢!

解决方案 »

  1.   


    select C_PART from DPSALES where ISNULL(GBACK,0) = 0
      

  2.   


    --try:
    select C_PART from DPSALES where isnull(GBACK,1)<>1
      

  3.   


    --查出不为真的
    select C_PART from DPSALES where isnull(GBACK,0)<>1
      

  4.   

    declare @DPSALES table(C_PART int,GBACK bit)
    --select C_PART from DPSALES where GBACK<>1
    insert @DPSALES select 1,1
    insert @DPSALES select 2,null
    insert @DPSALES select 3,null
    select C_PART from @DPSALES where GBACK is null
    /*
    C_PART      
    ----------- 
    2
    3(所影响的行数为 2 行)
    */
      

  5.   

    你是要找出NULL值吗?select C_PART FROM DPSALES WHERE GBACK IS NULL