A Construction problem of SQL query statement

here"s the thing. I have a table called list, and the fields used in this operation are updated_at and grab.
updated_at is the last update time.
grab represents whether the information is crawled or not. A value of 1 means it is crawled, and a value of 0 means it is published by users of this site.

< hr >

now I want to take the latest data and show it to users, but I hope the information posted on this site is at the top of the list. The strategy is that the information with a grab of 1 is the same as the ranking of the information released by this site ten days ago.
how to write this sql statement?

< hr > The

ps: result set grab = 1 and grab = 0 are merged into one set, and the result set cannot be separated. For example, the ranking released by users of this site 5 days ago is higher than that of the latest crawl, but the ranking of the latest crawl is higher than that released locally 11 days ago, and the ranking released by this site 12 days ago is higher than that of 5 days ago, rather than ranking the local and crawling separately.

Feb.28,2021

you can query several types of data separately and merge them with union all.


select * from

select * from list where grab = 1 and  day(now()) - day(updated_at) >10 as g1 order by  updated_at
union
select * from list where grab = 0 as g2 order by updated_at

calculate a sort code field according to the collation, and then sort by this field, for example:

SELECT t.*, 
CASE when grab = 1 and day(now()) - day(updated_at) >10 then 1
     when grab = 0 and day(now()) - day(updated_at) >5  then 2
END sort_code
from T
order by sort_code
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea89d1-1ee4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea89d1-1ee4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?