Re: MySQL: Random select with specific count of a column

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Torsten,

     This is one, but I think you can find another one:
     Supose your table is called tablename
     
     select * from tablename as a left join tablename as b on
     a.category = b.category and a.name<>b.name and
     a.language=b.language where a.language='de' and b.name is not
     null group by a.category

....
TR> I would like to select 6 random rows where the language is 'de' AND make
TR> sure that I will always have 2 rows of EACH category in my result set:
....
-- 
Best regards,
 Pablo

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux