求教Sql语句。。。。
表结构:ID,Text,DataType,IsError(是否为问题数据0否,1是),IShandle(处理状态1已处理,0未处理) 
                            1         a                     1                           0                        0 
                            2            b                  1                           1                        0 
                            3            c                  1                           1                        1 
                            4            d                  1                           0                        0   
 我想查出datatype=1的时候,所有的数据,包括已处理的问题数据,不包括未处理的问题数据 
 结果应该是ID为1,3,4的数据被查询出来。 
 请问这个要怎么写呢?
------解决方案--------------------select * from tb where DataType=1 and IShandle=1
------解决方案--------------------所有的数据,包括已处理的问题数据,不包括未处理的问题数据  
id为4的数据为什么要被查出来,id为4 的是没有处理的
------解决方案--------------------select * from tablename where datatype=1 and not(ishandle=0 and iserror=1)
------解决方案--------------------我想查出datatype=1的时候,所有的数据,包括已处理的问题数据,不包括未处理的问题数据  
结果应该是ID为1,3,4的数据被查询出来。  
你不觉得自相矛盾吗?
------解决方案--------------------我想查出datatype=1的时候,所有的数据,包括已处理的问题数据,不包括未处理的问题数据  
怎么会还有1,3,4
按照你给的数据应该只有3
------解决方案--------------------ID	地区	姓名	性别	是否超女
1	大陆	李宇春	 女	是
2	大陆	楼主	男	否
请将  大陆地区的超女,不包括非超女的男生选出来。
按照楼主的意思,就把1选择出来了。。。
到底选1还是选2,还是全选,还是不选呢,楼主,你纠结吗?
------解决方案--------------------可能是楼主描述的有点问题,他所说的所有已处理的问题,应该包括不是问题的那些数据
SQL code
create table #tab
(
    id int,
    text char(1),
    DataType bit,
    IsError bit,
    IsHandle bit
)
insert #tab
select  1 , 'a' , 1 ,  0  , 0  union all
select  2 , 'b' , 1 ,  1  , 0  union all
select  3 , 'c' , 1 ,  1  , 1  union all
select  4 , 'd' , 1 ,  0  , 0 
        
select id from #tab where DataType=1 and IsError=0 or(IsError=1 and IsHandle=1)
id
-----------
1
3
4
(3 row(s) affected)
------解决方案--------------------
楼主的问题提的有点问题吧