Hi Benjamin,
The perfect answer.
Thank you,
Anvar.
At 08:44 AM 16/02/2002 +0100, you wrote:
>Hi.
>
>On Fri, Feb 15, 2002 at 09:05:02PM -0800, [EMAIL PROTECTED] wrote:
> > In Re: Selecting records with the highest value no greater than x,
> <[EMAIL PROTECTED]> wr
* [EMAIL PROTECTED]
> In Re: Selecting records with the highest value no greater than
> x, <[EMAIL PROTECTED]> wrote:
> >
> >IMO, there is one, if I did understand the question correctly:
> >
> >SELECT * FROM NEWS WHERE RATING <= 4 ORDER BY RATING DESC,
>
In Re: Selecting records with the highest value no greater than x,
<[EMAIL PROTECTED]> wrote:
>
>IMO, there is one, if I did understand the question correctly:
>
>SELECT * FROM NEWS WHERE RATING <= 4 ORDER BY RATING DESC, RAND() LIMIT 1;
>
>This give back a random news
Hi.
On Fri, Feb 15, 2002 at 09:05:02PM -0800, [EMAIL PROTECTED] wrote:
> In Re: Selecting records with the highest value no greater than x,
><[EMAIL PROTECTED]> wrote:
> >
> >Hi Brent,
> >
> >I cannot think of a single query doing your job.
IMO, there is o
In Re: Selecting records with the highest value no greater than x,
<[EMAIL PROTECTED]> wrote:
>
>Hi Brent,
>
>I cannot think of a single query doing your job. But it can be done
>with two.
>
>SELECT @maxrating := MAX(RATING) FROM NEWS WHERE RATING <= 4;
&g
Hi Brent,
I cannot think of a single query doing your job. But it can be done
with two.
SELECT @maxrating := MAX(RATING) FROM NEWS WHERE RATING <= 4;
SELECT * FROM NEWS WHERE RATING=@maxrating ORDER BY RAND() LIMIT 1;
Anvar.
At 02:36 PM 15/02/2002 -0700, you wrote:
I need some help here. Let'
How about
SELECT * FROM news WHERE rating <= 4
ORDER BY rating DESC, RAND() LIMIT 1;
Michael
On Fri, 15 Feb 2002, Brent Macnaughton wrote:
>
> I need some help here. Let's see if I can clearly describe it.
>
> I have a database containing "news" stories. Each story is assigned a
> "r
I need some help here. Let's see if I can clearly describe it.
I have a database containing "news" stories. Each story is assigned a
"rating" (1 thru 5) indicating its importance. (A story with a rating of 5
is more important than a story with rating of 1.)
Now, lets say that there are ten s