Append Results from two queries and output as a single table
I have two queries that I have to run, I cannon join them But their resultant tables have the same structrure.
For exa开发者_开发知识库mple I have
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 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
I think that magazin and book are varchar values and not columns in your table
select * from products where producttype in ('magazine', 'book');
Or, just a single query...
select *
from products
where producttype = magazine
or producttype = book
精彩评论