|
There are two tables:
1. parent table; 2. child table
parent primary key: id
child primary key: id, foreign key p_id
Now you need to query the parent records and sort them. The sorting principle is based on the number of subtables corresponding to each main table record. The main table records with subtable records of 0 must also be displayed. |
|