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

.
Menu