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

limit return to last 50 records

229 100+
Hi,

This apparently limits the return to the first 10 records

Expand|Select|Wrap|Line Numbers
  1. mysql> SELECT * FROM search LIMIT 0, 10;
How do you limit the return to the last 50?
Would that have to b done by date?

Thanks for your help
Richard
Nov 2 '07 #1
1 1342
omerbutt
638 512MB
Yes that can be done in 2 ways
1-with the date part
2-by moving to the last rec in the db

FOR 1 THE DATE PART:
you can do it with the date by first getting the current date and then calculating
the difference of the days but wait how could u guarantee that only 1 rec would be entered in the database for each day so that u calculate the last 50 records by moving back 50 days from the current date[:)].....soooooooooo it wont be aplicable in the case
FOR 2 THE LAST REC PART
Hmmmmmm........this seems to be solving the problem [:)] first u should go to the last rec in ur db by the following way i would specify the pseudo type coding u can use it in ur asp page with modification
for i to recordsize......(get the recordsize by using "recordsetobj.Recordsize")
recordsetobj.movenext
Loop
if ((recordsetobj.EOF)=="TRUE")-----or/-------if ((recordsetobj.BOF)=="FALSE")
{
for i=1 to 50
Response.Write recordsetobj("dbFieldName")
recordsetobj.MovePrevious
Loop
}
HOPE THAT MIGHT SOLVED UR PROBLEM [:)] TCZZZZZ


Hi,

This apparently limits the return to the first 10 records

Expand|Select|Wrap|Line Numbers
  1. mysql> SELECT * FROM search LIMIT 0, 10;
How do you limit the return to the last 50?
Would that have to b done by date?

Thanks for your help
Richard
Nov 25 '07 #2

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

Similar topics

2
by: Wm | last post by:
I'm trying to get a handle on the best way to handle setting up my listings so that I display groups of about 25 records per page. I currently have a page that returns over 1,000 names/addresses,...
6
by: middletree | last post by:
Yesterday, I posted a question which ended up giving me a lot of info, but the core question never got answered/solved. The short version is that when a page displays a number of records based on...
10
by: Randell D. | last post by:
Folks, I have a SELECT that returns with multiple records - It works when I have a LIMIT clause but when I try to include a GROUP BY clause, the select returns nothing (ie no records, no...
2
by: Mike | last post by:
New to PHP and MySQL. Using PHP5 and MySQL 4.1 Windows XP Pro IIS 5.1 I'm trying to page a recordset, and am using a LIMIT clause to fetch a defined range of records from my db. However, the...
4
by: emily_g107 | last post by:
Hi, I need to limit results in the following query type: ...
0
by: D. Dante Lorenso | last post by:
I need to know that original number of rows that WOULD have been returned by a SELECT statement if the LIMIT / OFFSET where not present in the statement. Is there a way to get this data from PG ?...
10
by: Vic Spainhower | last post by:
Hello, I have a php program that is building a grid (HTML table) from a MySQL database. The problems started when I added a dropdown menu to the grid and when I did the form buttons would not...
3
by: Ronald S. Cook | last post by:
I was told that if calling lots of records from the database (let's say 100,000), that the GridView's paging feature would automatically "handle" everything. But the 100,000 records are still...
1
by: dfw1417 | last post by:
I have used a query and report filter to return records related to a specific account id. I want to print a report including only the latest 6 records out of the set returned by the record filter. I...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.