是否可以进行查询,选择一条具有player_type' IF'和10个具有player_type' Gold'由卡规订购的#39; field / rand()desc?谢谢。下面是我的表的一些附加屏幕截图,显示了一些player_type' IF'和' Gold'记录。
Records with player_type as 'IF'
Records with Player Type as 'Gold'
基本上,我想结合SELECT *
FROM `my_players`
WHERE `player_type` = 'Gold'
ORDER BY cardweight / RAND( ) DESC
LIMIT 0 , 10
和
SELECT *
FROM `my_players`
WHERE `player_type` = 'IF'
ORDER BY cardweight / RAND( ) DESC
LIMIT 0 , 1
在一个查询中,如果可能的话,可以立即运行。
答案 0 :(得分:1)
您使用union all
:
(SELECT *
FROM `my_players`
WHERE `player_type` = 'Gold'
ORDER BY cardweight / RAND( ) DESC
LIMIT 0 , 10)
UNION ALL
(SELECT *
FROM `my_players`
WHERE `player_type` = 'IF'
ORDER BY cardweight / RAND( ) DESC
LIMIT 0 , 1)
答案 1 :(得分:0)
你可以做一个UNION:
SELECT *
FROM `my_players`
WHERE `player_type` = 'Gold'
ORDER BY cardweight / RAND( ) DESC
LIMIT 0 , 10
UNION
SELECT *
FROM `my_players`
WHERE `player_type` = 'IF'
ORDER BY cardweight / RAND( ) DESC
LIMIT 0 , 1