Perform a second screening from the result set

as shown in the figure, this association query is different in that it is associated with the same table

indicates that table_test

requirement: first query the result set of the field whose reply_type is 0, and then use the reply_id of the result set as the primary key to query the associated reply_parent

Mar.07,2021

select t1.* from table_test T1 left join table_test T2 on t1.reply_id = t2.parent where t1.reply_type = 0;
see if it is what you want


you can first query the data with zero type in the table_test table to form an intermediate table, and then query the middle

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