select top 700 * from objectaer work only in sqlse

2019-09-12 13:31发布

how can I select the last 700 entry in my access databse? I'm using this

    private string strsqlcommandBeta = "select top 700 * from objectaer  " +
    " order by objectdate desc" +
    "  ";

but I'm getting this error

The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect.

2条回答
\"骚年 ilove
2楼-- · 2019-09-12 14:18

Try "Limit 700" at the end

Select * from bla bla bla Limit 700
查看更多
冷血范
3楼-- · 2019-09-12 14:25

The SELECT statement includes a reserved word or an argument name that is misspelled or missing, or the punctuation is incorrect.

Typically this is a result of using a keyword as a field name in one of your tables, or as an alias in your query. If you don't "quote" the keyword-as-a-field-name with [] you'll get an error.

Although I can't see any keywords being used inappropriately in your query, try this:

SELECT TOP 700 * FROM [objectaer] ORDER BY [objectdate] DESC

It's also possible that the problem is not with your query, rather if objectaer is a query object you've created in Access that contains incorrect syntax, you're likely seeing the error for objectaer instead.

查看更多
登录 后发表回答