At 09:46 AM 5/3/2002, you wrote:
> > Nope. :)
> > The table could be in excess of 1 million rows. The
> > user sees just the
> > first 100 rows no matter what. If he wants to see a
> > different group of
> > records he can use the search fields at the top of
> > the form. I want the web
> > serve
> Nope. :)
> The table could be in excess of 1 million rows. The
> user sees just the
> first 100 rows no matter what. If he wants to see a
> different group of
> records he can use the search fields at the top of
> the form. I want the web
> server to serve as many pages/sec as possible and
>
ry is
> > executed. Right now it is done when the page first loads. But that
>should
> > be a trivial matter (I hope!).
>
>You can call mysql_num_rows() directly after query BEFORE you
>loop through the recordset. (if it was that You ment with "delay"...)
Yup
Mike
>---
> That would give the correct result, but it would still physically count
all
> the rows in the table which takes too long. This code will execute every
> time a web page opens that has a grid. Some of the grid pages are quite
> large, > 1 million rows. The person who designed the web page origina
"delay"...)
---
=d0Mi= , DCS.net
[EMAIL PROTECTED]
Original Message -
Date: 2-May-2002 17:22:44 +0200
From: mos <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: RE: Re: How to Count(*) with LIMIT
> At 03:48 AM 5/2/2
- Original Message -
From: "mos" <[EMAIL PROTECTED]>
> > > I have a Where clause like:
> > > select count(*) from table where LIMIT 100
> > > Unfortunately the Count(*) ignores the LIMIT clause entirely. Why?
>>
> >If You want to know the number of rows in the recordset retu
> I have a Where clause like:
> select count(*) from table where LIMIT 100
> Unfortunately the Count(*) ignores the LIMIT clause entirely. Why?
The answer is: Because the SQL query with COUNT(*) only returns one row...
-
At 03:48 AM 5/2/2002, you wrote:
> > I have a Where clause like:
> > select count(*) from table where LIMIT 100
> >
> > Unfortunately the Count(*) ignores the LIMIT clause entirely. Why?
> >
>
>Because the query returns only ONE row and LIMIT limits rows, not values.
>See ex. below
>X-Sieve: CMU Sieve 2.1
>X-Mail-from: [EMAIL PROTECTED]
>From: "Ryan Fox" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>, "mos" <[EMAIL PROTECTED]>
>Subject: Re: How to Count(*) with LIMIT
>Date: Thu, 2 May 2002 08:42:28 -0400
>X-Mailer:
- Original Message -
From: "mos" <[EMAIL PROTECTED]>
> I have a Where clause like:
> select count(*) from table where LIMIT 100
>
> Unfortunately the Count(*) ignores the LIMIT clause entirely. Why?
You could use least().
mysql> select least(count(*),30) from ct;
+-
mos,
Thursday, May 02, 2002, 8:11:33 AM, you wrote:
m> I have a Where clause like:
m> select count(*) from table where LIMIT 100
m> Unfortunately the Count(*) ignores the LIMIT clause entirely. Why?
Because first of all SELECT is executed and then LIMIT is applied.
m> It seems t
Hi,
LIMIT is applied AFTER select is executed and limits then number of
rows returned to the client. Since SELECT COUNT(*)... generates a single
row, LIMIT is useless.
You can do this :
SELECT from LIMIT 100
and check the number of rows actually returned.
I don't know which programming lan
Sorry, taken out of context please ignore my first response.
George
- Original Message -
From: "George Pitcher" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; "mos" <[EMAIL PROTECTED]>
Sent: Thursday, May 02, 2002 9:46 AM
Subject: Re: How to Cou
Can't you use the num_rows funtion to provide the count?
George
- Original Message -
From: "mos" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 02, 2002 6:11 AM
Subject: Re: How to Count(*) with LIMIT
> I have a Where clause like:
>
> I have a Where clause like:
> select count(*) from table where LIMIT 100
>
> Unfortunately the Count(*) ignores the LIMIT clause entirely. Why?
>
Because the query returns only ONE row and LIMIT limits rows, not values.
See ex. below:
SELECT count(login) FROM accounts WHERE d
15 matches
Mail list logo