Re: mysql query
| From: | Justin Patrin | Date: | Fri, 13 Aug 2004 17:23:09 +0000 |
| Subject: | Re: mysql query | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-35698@lists.php.net to get a copy of this message | ||
On Fri, 13 Aug 2004 15:20:36 +0200, Quentin Cotillard
<quentin@wellcreative.com> wrote:
> Consider a table similar to the one below.
> What I want to do is to get ONE random record from categories(cat) A
> and 5 random record from category B
>
> | ID | computer | name | cat |...
> 1 dell 834 A
> 2 ibm 526 A
> 3 apple 134 B
> 4 sony 333 A
> 5 dell 834 B
> 6 ibm 556 A
> 7 apple 534 B
> 8 sony 233 A
> 9 dell 874 A
> ....
>
> How could I construct my query to the mysql?
>
This is an SQL question, not a PHP question.
order by rand limit 5
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--