这条语句不能执行
原因是内层select中的count的原因
谁知道怎么回事或者提供其他的方法

解决方案 »

  1.   

    select count(*) from (select count(*) as temp from logs group by computer_id )lala
      

  2.   

    select count(*) from (select count(*) as temp from logs group by computer_id )lala
    ----------這個語句好象沒有意義啊。永遠都是1。
      

  3.   

    select count(*) from (select count(*) as temp from (
    select 1 as computer_id,1 as data
    union all select 1,2
    union all select 2,2
    union all select 3,2
    union all select 4,2
    ) as t
     group by computer_id )lala---
    4
      

  4.   

    等同于   求 包括null的不同computer_id的个数与
    select count(distinct computer_id) as temp from logs 
    不同
      

  5.   

    哦,看少了一部分,沒注意後面有個group by。 :)
      

  6.   

    select count(*) from (select count(*) as temp from logs group by computer_id )lala------------
    其實這個語句就等同於Select count(Distinct computer_id) from logs
      

  7.   

    鱼,不同的
    select count(*) from (select count(*) as temp from (
    select 1 as computer_id,1 as data
    union all select 1,2
    union all select 2,2
    union all select null,2
    union all select 4,2
    ) as t
     group by computer_id )lala------
    4select count(Distinct computer_id)  from (
    select 1 as computer_id,1 as data
    union all select 1,2
    union all select 2,2
    union all select null,2
    union all select 4,2
    ) as t------
    3
      

  8.   

    Haiwer(海阔天空), 哦, null導致的。