select *from table1 order by (select conut(1) from table2 where table2.id=table1 .id desc)

2024年11月28日 22:50
有2个网友回答
网友(1):

select t.* from tb1 as t
left join
(select id,count(id) as n from tb2 group by id) as a1
on t.id=a1.id
order by a1.n

网友(2):

hql 的时候要把select * 去掉