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!

sql LIMIT rows in version 4.1 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
 
In SQL Server I would use
select top 3 * from Events order by EventDate DESC

I have no idea what My SQl would require. I would suggest you repost in the My SQL forum. This one is dedicated to Microsoft SQL Server.

"NOTHING is more important in a database than integrity." ESquared
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top