【MySQL】存储过程中,怎么把多个select结果,合并成一个结果集返回?

提问

select userid,username,price,vol from table_a …
select userid,username,price,vol from table_b…

要让这两句形成一个结果集。怎么办?

解答

select userid,username,price,vol from table_a …
union all
select userid,username,price,vol from table_b…


以上亲测可用

发布了552 篇原创文章 · 获赞 201 · 访问量 18万+

猜你喜欢

转载自blog.csdn.net/sinat_42483341/article/details/103465381
今日推荐