How to optimize the unequal or in? in sql

In the

statement, how to optimize the statement if there is < > 0, or a range search that is not equal to a value?
and in,not in?

Mar.06,2021
If there are many values that do not exist in

, it is recommended to create a new temporary table to store these data, and then implement them through sql association. This will be more efficient. Of course, in the case of a small amount, it will be quick to use in or not in directly

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