普洱茶茶道视频教程:求助:Union的使用!

来源:百度文库 编辑:高校问答 时间:2024/04/28 18:54:13
以下三句查询分别生成了3个表
select AAA.*,3 as BZ from userdata AAA where (select count(*) from userdata where userdata.D_unit=AAA.D_unit)>=3

select AAA.*,2 as BZ from userdata AAA where (select count(*) from userdata where userdata.D_unit=AAA.D_unit)=2

select AAA.*,1 as BZ from userdata AAA where (select count(*) from userdata where userdata.D_unit=AAA.D_unit)=1
我该怎么使用Union语法将这3个表生成一个表然后再进行查询啊?