List:General Discussion« Previous MessageNext Message »
From:Peter Brawley Date:September 24 2013 1:49am
Subject:Re: grouping and limiting results and rand()
View as plain text  
On 2013-09-23 8:10 PM, Jeremiah Jester wrote:
> Hello,
>
> How would i go about selecting 5
> random cars that are flagged as internet_special (value 1) for each
> dealer from a specific table?  Ive tried sub selects with no luck.
> Here's a basic query that has my
> required conditional. Note that I get all unique dealers by doing a
> distinct(dealer_web_name). Make sense? Using mysql 5.
>
> select dealer_web_name,id,internet_special,active from inventory where
> internet_special=1 and active=1;
>
> Appreciate the help

For ideas see "Within-group quotas" at 
http://www.artfulsoftware.com/infotree/queries.php.

PB

-----
Thread
grouping and limiting results and rand()Jeremiah Jester24 Sep
  • Re: grouping and limiting results and rand()Peter Brawley24 Sep