May I ask WeChat Mini Programs how to delete the old data in the cloud database?

I want to make a data length limit, for example, if the length of a collection in a database exceeds 1000, sort by time, delete the old data, and then add new data.
now is the length limit and sorting I am more clear, but after sorting why remove did not understand, what should I do?


get the date of the data sorted as 1000, delete the data before that date

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-1e80629-6823f.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-1e80629-6823f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?