SQL如何使两个select语句查询结果合并一个?

2024-12-26 08:06:58
推荐回答(2个)
回答1:

这样,你把第一个和第二个select写到一个新select查询的from里面,用join连接使公司名字相等,在新的select中投影出公司名和两个count

回答2:

select * from

(select unit,count(*)as number from archives_management group by unit) A

inner join

(select fine_units,count(*) as fine_number from fine group by fine_units) B
on A.unit=B.fine_units