如何在 SELECT 语句中使用另一个 table 的值?
How to use values from another table in a SELECT statement?
select max(select col0 from table0) as col0, col1, col2
from table1
我希望从我的 "pseudo code" 中可以清楚地知道我正在尝试做什么。我基本上想从 table0
添加一个值到 table1
所以第一列的所有行都是相同的值。
但是 Toad 无法执行这种形式的代码。你能给我一个解决问题的方法吗?
聚合函数在子查询内,而不是围绕它:
select
(select max(col0) from table0) col0,
col1,
col2
from table1
select (select max(col0) from table0) as col0, tb1.col1, tb1.col2 from table1 tb1
select max(select col0 from table0) as col0, col1, col2
from table1
我希望从我的 "pseudo code" 中可以清楚地知道我正在尝试做什么。我基本上想从 table0
添加一个值到 table1
所以第一列的所有行都是相同的值。
但是 Toad 无法执行这种形式的代码。你能给我一个解决问题的方法吗?
聚合函数在子查询内,而不是围绕它:
select
(select max(col0) from table0) col0,
col1,
col2
from table1
select (select max(col0) from table0) as col0, tb1.col1, tb1.col2 from table1 tb1