How to import only last 30 records from a database

I

Igor Sudnik

I'm using "Get External Data" to retrieve data from database and it works
fine but all I need is last 30 records and I don't know how to do that not
changing a criteria in a query. Another words I'd like to write a query that
would extract only last 30 records whenever I refresh data in a worksheet.
Could anyone help me please?Thank you in advance.
 
F

Frank Kabel

Hi
you could create a query in your database which extracts only the last
30 entries using the SQL Top statement (you have to define what 'last'
is for you)
 
J

Jamie Collins

Frank Kabel said:
you could create a query in your database which extracts only the last
30 entries using the SQL Top statement

I fear you've presumed too much. The TOP N syntax is proprietary
syntax; I don't recall seeing this outside of SQL Server and Jet. The
'standard' sql way of doing this is to use a subquery. See this
thread:

http://groups.google.com/[email protected]

Jamie.

--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top