在 SSMS 中创建 table 并从另外 2 个 table 中添加 2 个记录的乘积

Create table & add a multiplication of 2 records from 2 other tables in SSMS

我有2个table,ID1,说ID 2,格式一样。

DROP TABLE IF EXISTS ID1;
SELECT _Close into ID1
FROM livedata where ID = 1;
SELECT * FROM ID1;

每个table的输出只有1条记录:

_Close
0.84931

我想创建一个新的 table,比如 xyz,它添加了 ID1 和 ID2 的乘积。我试过这个:

drop table if exists xyz;
select ID1._Close * ID10._Close into xyz;

但是得到这些错误:

The multi-part identifier "ID1._Close" could not be bound.
Msg 4104, Level 16, State 1, Line 95
The multi-part identifier "ID10._Close" could not be bound.
Msg 1038, Level 15, State 5, Line 95
An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Change the alias to a valid name.

那么我缺少的只是一段代码吗?

谢谢

您可以交叉连接表 ID1 和 ID2:

DROP TABLE IF EXISTS xyz;
SELECT ID1._Close * ID2._Close _Close INTO xyz
FROM ID1 CROSS JOIN ID2;
SELECT * FROM xyz;

参见demo