gpt4 book ai didi

mysql - 我需要从 3 个不同的表中检索单个列

转载 作者:行者123 更新时间:2023-11-29 01:16:57 25 4
gpt4 key购买 nike

我的 Sql Server 数据库有三个表(Amount、wthdrwl、spent),每个表都有 id 和 amount 列。我想从这三个不同的表中检索金额列。

最佳答案

对于 MySQL 和 SQL-Server,使用 UNION(隐式不同)或 UNION ALL:

SELECT Amount FROM Amount
UNION ALL
SELECT Amount FROM wthdrwl
UNION ALL
SELECT Amount FROM spent

关于mysql - 我需要从 3 个不同的表中检索单个列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19228031/

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