select top 20 * from [EventLog] where [ID] not in( select top 0 [ID] from [EventLog] order by [ID]) and [etDate] >= '2010-03-10' order by [ID],etDate,etTime"
错误提示:
_message "语法错误。 在查询表达式 '([ID] not in( select top 0 [ID] from EventLog order by [ID])) and etDate >= '2010-03-10'' 中。"
不好意思,我还是看不出错在哪里,请大家帮我找找,不胜感激.

解决方案 »

  1.   

    select top 20 * from [EventLog] where [ID] not in( select top 0 [ID] from [EventLog] order by [ID]) and [etDate] >= '2010-03-10' order by [ID],etDate,etTime"贴在这里比较清楚
      

  2.   

    select top 20 * 
    from [EventLog] 
    where [ID] not in( select top 0 [ID] from [EventLog] order by [ID]) 
    and [etDate] >= '2010-03-10' 
    order by [ID],etDate,etTime
    语法没有错,不会是因为后面多了个双引号吧
      

  3.   

    top 0 返回的不是表头吗?
      

  4.   

    不可能啊,我在Access数据中就是有错误,在SqlServer2005中正确,汗.
      

  5.   


    其实我的代码是这样写的:sqlString = "select top(" + pageSize.ToString() + ") * from EventLog 
    where (
    [ID] not in
    ( select top(" + var.ToString() + ") [ID] from EventLog order by [ID])
    ) and etDate >= '" + startTime + "' 
    order by [ID],etDate,etTime";
      

  6.   

    ACCESSTOP要加()????,米看出来哪错了
      

  7.   

    去掉()还是一样,好像把子句中的select top 0改成select top 2等非0的数字就可以了,
    难道不支持top 0?
      

  8.   

    TOP 0这个还真没有试过啊!
    得看看!!!!!!
      

  9.   

    真的,我直接用select top 0 * from 表名,这样查的话,会有错误哦.
      

  10.   

    在2005执行
    select top 20 * from tablename where id (select top 0 * from tablename )
    可以执行没有问题
      

  11.   

    select 
    top 20 * 
    from 
    [EventLog] 
    where [ID] not in( select top 0 [ID] from [EventLog] 
    order by [ID]) and [etDate] >= '2010-03-10' 
    order by [ID],etDate,etTime
    语法没有问题,只是多了个"
      

  12.   

    access中时间不是用单引号引起来的吧,好象要用#号,你试试!select 
    top 20 * 
    from 
    [EventLog] 
    where [ID] not in( select top 0 [ID] from [EventLog] 
    order by [ID]) and [etDate] >= #2010-03-10# 
    order by [ID],etDate,etTime
      

  13.   


    SqlServer2005和2000中是没有问题哦,不过我的数据库是Access
    现在总结一下,我发现select top 0 * 用在Access数据库中会出错,top 后面必须接大于0的整数
    还有就是select top(1) * 也会出错,在Access中不能用括号,
    但是在SqlServer数据库中可以使用select top(0) * from 表名如果说的不对,请大家指正,再次谢谢大家