日期:2014-05-16  浏览次数:20431 次

一表数据我打算就显示 有数据的内容该如何写sql
表内容如下
id      varchar(10)  varchar(10)  datetime
18 6000 0 2009-03-29 08:00:00
20 2009-03-29 08:00:00
21 2009-03-29 08:00:00
22 6000 0 2009-03-31 08:00:00
23 2009-03-31 08:00:00
24 2009-03-31 08:00:00
25 6000 0 2009-04-01 08:00:00
26 2009-04-01 08:00:00
27 2009-04-01 08:00:00
28 5990 0.005 2009-04-09 08:00:00

我 想显示 
18 6000 0 2009-03-29 08:00:00
22 6000 0 2009-03-31 08:00:00
25 6000 0 2009-04-01 08:00:00
28 5990 0.005 2009-04-09 08:00:00
全部有数据的
------解决方案--------------------
select * from tb where col1 is not null and col2 is not null

------解决方案--------------------
试试这个:

select *
from 表
where id is not null and      
      varchar(10)字段 is not null and
      varchar(10)字段 is not null and
      datetime字段 is not null

------解决方案--------------------
isnull(col,'')=''

试试这个
------解决方案--------------------
isnull(col,'')<>''
这个比较稳妥点。