Requirements are in accordance with the pv field tableName2 descending order then pv maximum group detected in each group of the records, the situation is executed according to the parent ascending order, how to deal with this
CodePudding user response:
The select t3. * from t3, t (The select t2. The parent, t2. Pv from (
Select t1. * from t t1 order by t1. The pv desc
) t2 group by t2. The parent
T4)
Where t3. The parent=t4. Parent and t3. The pv=t4. Pv