MySQL: Random select with specific count of a column

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

 



Hi,

I've got the following table:

category    language    name
1           de          a
1           de          b
1           de          c
2           de          a
2           de          b
2           de          c
3           de          a
3           de          b
3           de          c
...
1           en          a
1           en          b
1           en          c

I would like to select 6 random rows where the language is 'de' AND make
sure that I will always have 2 rows of EACH category in my result set:
1           de          b
1           de          c
2           de          a
2           de          c
3           de          a
3           de          b

Any help greatly appreciated.


Thanks and best regards,

Torsten Roehr

-- 
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