473,395 Members | 1,956 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,395 software developers and data experts.

query results by date for last 50 results

229 100+
Hi, I have looked arouind and cannot find a way to query my database by date for the last 50 added results only.
I found this which I suppose might be something similar but I need only the most recent 50 added. That might be the last 10 days or 20 depending how many i add per day.

Expand|Select|Wrap|Line Numbers
  1. strSQL = "SELECT * from myTable WHERE [surgeryDate] LIKE ' " & fromDate & " ' " 
Expand|Select|Wrap|Line Numbers
  1. the querys I have for all results are like this
  2. lngCategoryID=CLng(Request("CategoryID"))
  3. If lngCategoryID <> "" And lngCategoryID <> 0 Then
  4.  
  5.     Set connPostCardSoft=Server.CreateObject("ADODB.Connection") 
  6.     connPostCardSoft.Open PostCardSoftConnectString
  7.     Set rsCard=Server.CreateObject("ADODB.Recordset")
  8.     rsCard.CursorLocation = 3
  9.     SQLQuery="Select PostCardID,DefaultHeadline,CardDescription,DefaultMessage,extratwo,extrathree,Author,AuthorTwo,NewImageOne,NewImageTwo,NewImageThree,NewImageFour,NewImageFive,NewImageSix,NewImageSeven,NewImageEight,ThumbnailURL,AdvancedCard,BackgroundImageURL,ThumbnailHTML From tblGreetingPostCards Where CategoryID=" & Clng(lngCategoryID) & " Order By BackgroundImageURL DESC"
  10.     rsCard.Open SQLQuery, connPostCardSoft
  11.        rsCard.PageSize = 1000
  12.        intPageCount = rsCard.PageCount
  13.  
  14.        If rsCard.EOF=True Then
  15.         Response.Write "<p>No artists found in database for this category."
  16.         Response.End
  17.     End If
  18. End If
If anyone can help that would be great.
Thanks
Richard
Dec 8 '07 #1
2 1295
JamieHowarth0
533 Expert 512MB
Hi Richard,

There's an article on Wikipedia on the SELECT function in SQL, which describes the standard (and non-standard) ways of limiting the number of rows returned from a query (depending on your database engine).
It doesn't go into huge detail on the other parts of a SELECT query but contains all the information you need for your particular requirement.
The link is http://en.wikipedia.org/wiki/Select_(SQL).

Hope this helps.

Best regards,

medicineworker
Dec 9 '07 #2
fran7
229 100+
Dear Medicineman,
Thanks for that really useful link.
Richard
Dec 12 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Willem | last post by:
Hi there, I'm sort of new with doing much record manipulation with queries. Up till now I've been programming VBA and doing record looping to get my results. This works fine but tends to get...
2
by: Georges Heinesch | last post by:
Hi. I thought this query would be trivial. After numerous attempts w/o success, I start to doubt ... The follwoing table: Date From To 01.01.2005 SFO BOS 01.01.2005 SFO MIA
2
by: solar | last post by:
I have a problem with building a totals query showing data for the last date only.Under the last date i understand the last date of field invoicedate.This invoice date is in the table orders....
7
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always...
24
by: clare at snyder.on.ca | last post by:
I have a SQL query I need to design to select name and email addresses for policies that are due and not renewed in a given time period. The problem is, the database keeps the information for every...
10
by: Daniel | last post by:
In Microsoft Access I can write a query that includes the criteria: Between Date()-7 And Date() to retrieve the records from a table that fall within the last week. I'm trying to write a...
1
by: bruce24444 | last post by:
First of all I'm new to the forum and am working on my first database. So far I think I've done not too bad but have hit a stumbling block for which I'm not sure how to get around. What I have is...
4
by: kdubble | last post by:
Hi I am trying to get the results of a query to show only unique student records (not duplicates). Is there a simple way to make the criteria field do this? I am not too familiar with SQL. ...
7
by: bruce.dodds | last post by:
Access seems to be handling a date string conversion inconsistently in an append query. The query converts a YYYYMM string into a date, using the following function: CDate(Right(,2) & "/1/" &...
2
by: wevans | last post by:
I have 3 tables, Customer, Offsite Service and service. I need to create a sales report/query based on the results of the user input, which is a date range. I've got it working great with two of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.