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'' 中。"
不好意思,我还是看不出错在哪里,请大家帮我找找,不胜感激.
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
语法没有错,不会是因为后面多了个双引号吧
其实我的代码是这样写的: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";
难道不支持top 0?
得看看!!!!!!
select top 20 * from tablename where id (select top 0 * from tablename )
可以执行没有问题
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
语法没有问题,只是多了个"
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
SqlServer2005和2000中是没有问题哦,不过我的数据库是Access
现在总结一下,我发现select top 0 * 用在Access数据库中会出错,top 后面必须接大于0的整数
还有就是select top(1) * 也会出错,在Access中不能用括号,
但是在SqlServer数据库中可以使用select top(0) * from 表名如果说的不对,请大家指正,再次谢谢大家