How to create a complex MySQL query?

there is a table
id integer
name varchar
status integer (1 or 2)
created date

You need to create one query
you should write the application with status 2 created does not exceed the end of the current day, sorted by created ASC
- output requests with a status of 1, sorted by created DESC
April 4th 20 at 00:52
1 answer
April 4th 20 at 00:54
Solution
(SELECT id, name, status, created FROM table WHERE status = 2 AND DATE(created) <= CURRENT_DATE ORDER BY created ASC)
UNION ALL
(SELECT id, name, status, created FROM table WHERE status = 1 ORDER BY created DESC)

Find more questions by tags MySQL