Re: SQL Row Counting in MySQL

2002-11-26 Thread Steve Yates
On Tue, 26 Nov 2002 15:01:08 -, Tom Place wrote:

>a simple way in MySQL to only select the first x rows

See LIMIT:

http://www.mysql.com/doc/en/SELECT.html

 - Steve Yates
 - If at first you don't succeed, then skydiving isn't for you.

~ Taglines by Taglinator - www.srtware.com ~

Steve Yates
Integrated Technical Solutions, Inc.

E-Mail - [EMAIL PROTECTED]
Web- www.teamITS.com
Phone  - 630.420.2550
Fax- 630.420.2771



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: SQL Row Counting in MySQL

2002-11-26 Thread Alec . Cawley



> Is there a simple way in MySQL to only select the first x rows that meet
> a specified criteria.

> For example in Oracle the following would work:

> Select * from Blah where stuff="true" and rownum <= 10
? (where rownum is not a specific column, just a count of how many rows
> have been returned)

> But MySQL doesn't like this.

> Anyone know the correct way to approach this??

The keyword you want is LIMIT - see http://www.mysql.com/doc/en/SELECT.html

LIMIT 5  - return first five rows
LIMIT 5, 10 - return sixth through fifteenth rows (row numbers count from
o)

  Alec



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




re: SQL Row Counting in MySQL

2002-11-26 Thread Victoria Reznichenko
Tom,
Tuesday, November 26, 2002, 5:01:08 PM, you wrote:

TP> Is there a simple way in MySQL to only select the first x rows that meet
TP> a specified criteria.

TP> For example in Oracle the following would work:

TP> Select * from Blah where stuff="true" and rownum <= 10
TP> (where rownum is not a specific column, just a count of how many rows
TP> have been returned)

TP> But MySQL doesn't like this.

TP> Anyone know the correct way to approach this??

Use LIMIT clause:
http://www.mysql.com/doc/en/SELECT.html



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Victoria Reznichenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
   <___/   www.mysql.com





-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: SQL Row Counting in MySQL

2002-11-26 Thread Gelu Gogancea
Hi,
Select * from Blah where stuff="true" limit 10;

Regards,

Gelu
_
G.NET SOFTWARE COMPANY

Permanent e-mail address : [EMAIL PROTECTED]
  [EMAIL PROTECTED]
- Original Message -
From: "Tom Place" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 26, 2002 5:01 PM
Subject: SQL Row Counting in MySQL


> Hi All,
>
> Is there a simple way in MySQL to only select the first x rows that meet
> a specified criteria.
>
> For example in Oracle the following would work:
>
> Select * from Blah where stuff="true" and rownum <= 10
> (where rownum is not a specific column, just a count of how many rows
> have been returned)
>
> But MySQL doesn't like this.
>
> Anyone know the correct way to approach this??
>
> Cheers
>
> Tom
>
>
> -
> Before posting, please check:
>http://www.mysql.com/manual.php   (the manual)
>http://lists.mysql.com/   (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: SQL Row Counting in MySQL

2002-11-26 Thread Joakim Andersson
Tom Place wrote:

Hi All,

Is there a simple way in MySQL to only select the first x rows that meet
a specified criteria.

For example in Oracle the following would work:

Select * from Blah where stuff="true" and rownum <= 10
(where rownum is not a specific column, just a count of how many rows
have been returned)

But MySQL doesn't like this.

Anyone know the correct way to approach this??


SELECT * FROM blah WHERE stuff="true" LIMIT 0,10

Regards
Joakim


-
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: SQL Row Counting in MySQL

2002-11-26 Thread Pae Choi
There is SQL function called COUNT. Check it out and
see of that helps you.


Pae




> Hi All,
>
> Is there a simple way in MySQL to only select the first x rows that meet
> a specified criteria.
>
> For example in Oracle the following would work:
>
> Select * from Blah where stuff="true" and rownum <= 10
> (where rownum is not a specific column, just a count of how many rows
> have been returned)
>
> But MySQL doesn't like this.
>
> Anyone know the correct way to approach this??
>
> Cheers
>
> Tom
>
>
> -
> Before posting, please check:
>http://www.mysql.com/manual.php   (the manual)
>http://lists.mysql.com/   (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail
<[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




SQL Row Counting in MySQL

2002-11-26 Thread Tom Place
Hi All,

Is there a simple way in MySQL to only select the first x rows that meet
a specified criteria.

For example in Oracle the following would work:

Select * from Blah where stuff="true" and rownum <= 10
(where rownum is not a specific column, just a count of how many rows
have been returned)

But MySQL doesn't like this.

Anyone know the correct way to approach this??

Cheers

Tom


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php