8
I have a table and want to get 15 values with one order and 15 with another order. The aim is getting exactly 30 distinct values.
This is my code:
(SELECT * FROM table1 WHERE criteria ORDER BY views DESC LIMIT 15)
UNION All
(SELECT * FROM table1 WHERE criteria ORDER BY date_upload DESC LIMIT 15)
I know how to complete the task with two queries ( with NOT IN ), but is there a way to make it in one query?