解决方案 »

  1.   

    select count(img)
    from (
    select id,img1 as img from 现有一个表t 
    unoin all
    select id,img2 as img from 现有一个表t 
    unoin all
    select id,img3 as img from 现有一个表t 
    unoin all
    select id,img4 as img from 现有一个表t 
    unoin all
    select id,img5 as img from 现有一个表t 
    unoin all
    select id,img6 as img from 现有一个表t 
    unoin all
    select id,img7 as img from 现有一个表t 
    unoin all
    select id,img8 as img from 现有一个表t 
    unoin all
    select id,img9 as img from 现有一个表t 
    ) v
      

  2.   

    select count(img)
    from (
    select id,img1 as img from tt
    unoin all
    select id,img2  from tt
    unoin all
    ...
    unoin all
    select id,img9  from tt 
    )  a where img is not null