If you are using MySQL as your database backend, read
http://www.desilva.biz/mysql/random.html  (found by Googling "mysql
random row").

If you are not using MySQL, check if your database has a similar
function.

On May 19, 5:56 am, Sarpidon <epap...@gmail.com> wrote:
> Hi everybody.
>
> I have a companies table and those companies have promotions. Each
> company can have up to 10 promotions but only 2 can be displayed from
> each company at one time. I've been trying to figure out how to
> generate a single query that will select only 2 promotions randomly
> from each company. Is that even possible?
>
> see screenshot attached -->http://screencast.com/t/dB2sqcEns
>
> so basically randomly select only 2 promotions with the same
> company_id...
> possible? how?
>
> Thank you for your time.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to