比如,在表AAA中,有a,b c,d 共4列;每列数据行数不一样多。
    a    b    c     d
    1    6    9     10
    2    7          11
    3    8          12
    4               13
    5               14
                    15怎么判断AAA表中a,b,c,d每列的行数各是多少?
这里的话,
a列行数:5
b列行数:3
c列行数:1
d列行数:6

解决方案 »

  1.   

    Select count(a) AS A,count(b) AS B,count(c) AS C,count(d) AS D From AAA
      

  2.   

    这个怎么判断是否有数据?比如数字
    select count(*) from AAA where a <> 0
      

  3.   

    文本
    select count(*) from AAA where b <>''
      

  4.   

    select count(*) from AAA where c is not null
      

  5.   

    首先谢谢两位,我想:
        在查询分析器中 
        Select count(a) AS A,count(b) AS B,count(c) AS C,count(d) AS D From AAA没问题
        用VB,如何一次性获取每列的行数?不想分开一个一个获取。
        
      

  6.   

    用个记录集反应这个SQL语句的结果就行了
    for i=0 to rs.fields.count
    debug.print rs.fields(i).value
    next
      

  7.   

    这个问题sql版讨论过,结果忘了。
      

  8.   

    informix里通过,你要知到systable一样的。
      Select 
      (select count(*) from AAA where a is not null),
      (select count(*) from AAA where b is not null),
      (select count(*) from AAA where c is not null),
      (select count(*) from AAA where d is not null) 
    from
      systables
    where 
      tabid = 1