select count(distinct Id) as Number
from Table1Access数据库,Delphi 7,不知道错在哪里?错误信息‘select子句中包含一个保留字、拼写错误或丢失的参数,或标点符号不正确’.

解决方案 »

  1.   

    select count(distinct) Id 
    from Table1 
      

  2.   

    distinct Id 是一个字段吗?select count(distinct Id)  Number from Table1 
      

  3.   

    number是数据库的关键字 改个别的吧
      

  4.   

    oracle里可以这么用的:
    select count(operatorid) id from V_USERCHANGETOTAL
    id为新起的列别名
      

  5.   


    select count(abc) from (select distinct Id as abc
    from Table1)
      

  6.   

    Number在Access里是关键字,还有id,name等等......
      

  7.   

    distinct应该不能包含在聚合函数之中,建议用查询 
    Select Count(*) as Number From (select distinct Id from Table1 )
      

  8.   

    如果实在要用 就把number用引号括起来 
    select count(distinct Id) as "Number"
    from Table1