当然当然是
select top 20 B7 from TABLE where ID not in   --not in
(select top 20 ID from TABLE where B7='4'     --等于4
and  ID2 in(74,75)
order by B7 Desc) order by B7 Desc

解决方案 »

  1.   

    既然不显示B7中值为4的记录﹐那就要把這個條件加進去select top 20 B7 from TABLE where B7<>'4' and ID not in(select top 20 ID from TABLE where B7<>'4' and  ID2 in(74,75) order by B7 Desc) order by B7 Desc
      

  2.   

    随机取数只要:
    select top 20  b7 from [table] where b7<>'4'  --and id2 in (74,75)  
    order by b7 desc --这样就行了吧,但不是随机的select top 20  b7 from [table] where b7<>'4'  --and id2 in (74,75)  
    order by newid() --随机
      

  3.   

    select top 20 B7 from TABLE where B7<>'4'  amd ID not in(select top 20 ID from TABLE where B7<>'4' and  ID2 in(74,75) order by B7 Desc) order by B7 Desc
      

  4.   

    B7<>'4' 這個條件要加在第一個where 后面﹐才能保証B7<>'4' 的記錄不顯示出來