我以sysdba身份登录系统select segment_type,segment_name,(select count(*) from segment_name) RowsNum
from dba_segments where tablespace_name = 'USERS' and segment_type = 'TABLE'就是那个计数项怎么报错呢???不会不支持自查询吧?

解决方案 »

  1.   

    从来没听说过SQL语句中有自查询,也没见过from后面加字段名的。这样修改:
    select segment_type,segment_name,coun(*)  RowsNum
    from dba_segments where tablespace_name = 'USERS' and segment_type = 'TABLE'
    group by segment_type,segment_name
      

  2.   

    ,(select count(*) from segment_name) RowsNum,要不要加as阿?
      

  3.   

    写法不对,如果有count也要有个group by啊