How does mysql random N different pieces of data from two tables?

there are two existing text tables (some fields are different). If you want to random N pieces of non-duplicated data from these two article tables, how do you write the SQL statement?

Jun.06,2022


union  as 

select * from table order by rand () LIMIT N


Baidu can find the answer, why ask here?

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