473,473 Members | 1,843 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Number of matches of a select

Hi!
I make a select with a select clause and I limit it to 5 results, but
I need to know if there are more matches to enable a "next" link to
see the others
I've thought about not limiting it in the query but displaying only 5
results so I could know if there are more matches I don't display, but
maybe it's slower.
My question is: Is there any functon that retrieves the number of
matches without loading data to make the system faster?
Thanks
Jul 23 '05 #1
1 1753
salva wrote:
I've thought about not limiting it in the query but displaying only 5
results so I could know if there are more matches I don't display, but
maybe it's slower.
select * from tablename limit 6;

show only 5, and if the amount of returned rows is 6, you know there are
more left and you can do another query.
My question is: Is there any functon that retrieves the number of
matches without loading data to make the system faster?


Or...

select count(*) from tablename;

which will return a number of rows matching. Use this instead of the
first only if you are planning to show navigation buttons to jump bigger
steps between the results instead of just showing [back] and [next]. For
example:
[1-10] [11-20] [21-30] [31-40] etc.

Because the first one is most likely faster with limit 6 than making two
queries.
Jul 23 '05 #2

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

Similar topics

3
by: Martin Lucas-Smith | last post by:
I am trying to take a string and split it into a filename and a number where the number is what follows the *last* instance of a comma in that string. Split and explode won't work because if the...
7
by: D. Alvarado | last post by:
Hello, Can regular expressions help me here? I want to extract a number from a string which will always be of the form "parameter###" where "###" is an arbitrary number of numeric digits. So if...
6
by: John R | last post by:
Hi all, I'm trying to get my VB6 app to look up prefixes for a phone number out of an MDB file along with an associated price etc. For example the phone number could be 9802xxxx, and the MDB...
1
by: Sam G | last post by:
Hi folks, What I'd like to do for a website I'm designing with PHP/MySQL is have a number of registered users who can make friends with each other... so if person 1 wants to be friends with...
1
by: Scott269 | last post by:
So I've got an old MS Works database I imported into Access. I needed a primary key so I created a record number field that was just the record number I manually inserted when I entered it in the...
21
by: Jaspreet | last post by:
I was working on some database application and had this small task of getting the second highes marks in a class. I was able to do that using subqueries. Just thinking what is a good way of...
5
by: s.schmeier | last post by:
Hi everybody, we want extract numbers from strings and wonder if there is already a module around for doing this. An example in our case would look like this: 0.032 +/- 0.5 x 10(-4) it...
5
by: RolfK | last post by:
Dear ALL, I'm writing some first examples to get a better understanding of XSLT/ XPATH2.0. Please excute this code, any xml input is OK. I'm using saxon. The example runs perfect with ALTOVA,...
7
by: harijay | last post by:
Hi I am a few months new into python. I have used regexps before in perl and java but am a little confused with this problem. I want to parse a number of strings and extract only those that...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.