MySQL statement to ask for help

how does sql write from the database table to the display of the page?

requirement: the first-level classification needs sorting, the first-level classification shows its subcategories, and the subcategories also need sorting.

Feb.27,2021

use recursion


-- with()
WITH temp(ID,Title,Url,ParentID,SortID)
AS
(
--1:ParentID=0
SELECT ID,Title,Url,ParentID,1 AS Level FROM [TableName]
WHERE ParentID=0
UNION ALL
--2:
--3:
SELECT a.ID,a.Title,a.Url,a.ParentID,b.SortID FROM [TableName] a

INNER JOIN
temp b
ON (a.ParentID=b.ID)--
)
SELECT * FROM temp--4:  
  

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