Come combinare (impilare verticalmente) le seguenti 3 query in una query che restituisce 100 righe, 50 righe dalla categoria 1, 25 dalla categoria 2, 25 dalla categoria 3 tutte scelte a caso. Ho provato UNION ma non sembra funzionare.stack verticale risultati MySQL in singola query
select * from table where category_id = 1 order by rand() limit 50;
select * from table where category_id = 2 order by rand() limit 25;
select * from table where category_id = 3 order by rand() limit 25;
A 'UNION ALL' dovrebbe funzionare se si racchiude ciascuna parte in paren '(SELEZIONARE ...) UNIONE TUTTI (SELEZIONA ...) ...' –