Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Limit rows in MySql 4.1

Status
Not open for further replies.

Kris91261

Programmer
Oct 26, 2007
3
US
I've used the LIMIT function in mySql 5.0 with no problem. Such as:
sql = "select * from Events order by EventDate DESC, 'LIMIT 0,3'"

I have tried to use the same query on a mySql 4.1.22 server and I don't get an error but it doesn't adhere to the LIMIT part of the query.

Any ideas on a way to pull four rows from a table without the LIMIT function? I want the four most recent entries in the table.

I would appreciate any help you could give.

Thanks,
Kris91261
 
r937,

I should have mentioned that this sql statement is in the context of ASP. Without the single quotes it fails completely. I have used the LIMIT parameter on a server that was running MySql 5.0 and had no problem. Version 4.1 does not fail with the statement but it ignores the LIMIT parameter. Do you know of any other ways to extract the last 4 records in a table? Thanks for you help.

Kris91261
 
try running your queries outside of ASP and you will see that the single quotes are not allowed, and the LIMIT does work

r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top