附加来自两个查询的结果并作为单个表输出 [英] Append Results from two queries and output as a single table

查看:16
本文介绍了附加来自两个查询的结果并作为单个表输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个必须运行的查询,我无法加入它们但是它们的结果表具有相同的结构.

I have two queries that I have to run, I cannon join them But their resultant tables have the same structrure.

例如我有

select * from products where producttype=magazine

select * from products where producttype = book

我必须将这两个查询的结果结合起来,然后作为一个结果输出.我必须在存储过程中执行此操作.

I have to combine the result of these two queries, and then output it as one single result. I have to do this inside a stored procedure.

PS 这些只是我提供的例子,我有一个复杂的表结构.主要是我不能加入他们.

PS These are just examples I provided, i have a complex table structure. The main thing is I cannot join them.

推荐答案

select * from products where producttype=magazine
union
select * from products where producttype = book

这篇关于附加来自两个查询的结果并作为单个表输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆