473,320 Members | 1,861 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

most recent output

TJM
hello,

I have a table which contains the audit time field. This audit time field
records the current date and time when a record is inserted.
I would like to output the most recent top 500 rows.
thank you.

Jul 20 '05 #1
3 1355
On Sat, 11 Sep 2004 06:01:38 -0400, TJM wrote:
hello,

I have a table which contains the audit time field. This audit time field
records the current date and time when a record is inserted.
I would like to output the most recent top 500 rows.
thank you.


Hi TJM,

SELECT TOP 500 Column1, Column2, ..., ColumnN
FROM ATable
ORDER BY AuditTimeColumn DESC
Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
Jul 20 '05 #2
TJM
what if there are other fields in the order by clause?

So, it is like.. I queried the most recent top 500 rows and then I need to
sort by column 1, column2, column3 within the most recent top 500 rows.

is it possible to make them in one query to generate the output?

thanks again

"Hugo Kornelis" <hugo@pe_NO_rFact.in_SPAM_fo> wrote in message
news:ld********************************@4ax.com...
On Sat, 11 Sep 2004 06:01:38 -0400, TJM wrote:
hello,

I have a table which contains the audit time field. This audit time field
records the current date and time when a record is inserted.
I would like to output the most recent top 500 rows.
thank you.


Hi TJM,

SELECT TOP 500 Column1, Column2, ..., ColumnN
FROM ATable
ORDER BY AuditTimeColumn DESC
Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)

Jul 20 '05 #3
On Sun, 12 Sep 2004 21:57:13 -0400, TJM wrote:
what if there are other fields in the order by clause?

So, it is like.. I queried the most recent top 500 rows and then I need to
sort by column 1, column2, column3 within the most recent top 500 rows.

is it possible to make them in one query to generate the output?

thanks again

Hi TJM,

Yes - use a derived table:

SELECT Column1, Column2, ..., ColumnN
FROM (SELECT TOP 500 Column1, Column2, ..., ColumnN
FROM ATable
ORDER BY AuditTimeColumn DESC) AS DerivedTable
ORDER BY Column1, Column2, Column3
(untested)

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Nova's Taylor | last post by:
Hi folks, I am a newbie to Python and am hoping that someone can get me started on a log parser that I am trying to write. The log is an ASCII file that contains a process identifier (PID),...
3
by: Suresh Kumaran | last post by:
How do you program in VB.NET to show the most recent used document in a dropdown menu? I am referring to something like in MS WORD or EXCEL where it shows the recent document the user was working...
6
by: HandersonVA | last post by:
There are several day_timestamp for each index_id. Anyone can help me to write a sql to generate the most recent day_timestamp of index_ids which has not accessed into the system in 90 days from...
10
by: perryche | last post by:
Experts, I have the following scenario: Table1: RecordID RecordDate ... I want in a query to show me within this RecordID, only the latest RecordDate and info. I know I can use the Max...
1
by: pht204 | last post by:
Hi there, I have a list of date on my table: ClientName ClientPurchase PurchaseDate PuarchesItems Let's say, the purchas dates are multiples and I want to get each clients with their most...
4
by: Lee | last post by:
I have an application where I need to find the most recent file placed in a folder. For example, my users periodically place an image file with the format "ImageXXXX.jpg" (where XXXX is some...
1
by: Jonathan | last post by:
I have the following query which is retrieving a set of data it is almost what I want but I can not manage to get the result I desire. SELECT r1, r1_dev, r2, r2_dev, date, time FROM output...
2
by: robert.waters | last post by:
I need to perform the following: - select the most recent X number of records in a table (there is a timestamp field) - select the Nth occurrence of X number of records ex: - most recent 10...
4
by: zacks | last post by:
Most applications whose purpose is to work with various types of files implement a "Most Recent Files" list, where the last, say, four files accessed by the application can quickly be re-opened by...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.