gpt4 book ai didi

sql - 附加两个查询的结果并输出为单个表

转载 作者:行者123 更新时间:2023-12-02 07:16:27 26 4
gpt4 key购买 nike

我有两个必须运行的查询,我无法连接它们,但它们的结果表具有相同的结构。

例如我有

select * from products where producttype=magazine

select * from products where producttype = book

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

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

最佳答案

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

关于sql - 附加两个查询的结果并输出为单个表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4619090/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com