SQL 使用子查询和列乘法插入值
SQL Insert values with subquery and column multiplication
我正在尝试将包含列乘法的子查询的值插入 table。这非常有效,但是如果我查询 table,它只有 0 个值。有人知道为什么吗?
我的查询是:
create table user_payments
(payment_stream number(4));
insert into user_payments (payment_stream)
select ct.min_price*s.stream_min as payment_stream
from users u
, streaming s
, content_type ct
, contract c
, media_content mc
where u.user_ID = s.user_ID
and mc.media_content_ID = s.media_content_ID
and ct.content_type_ID = mc.content_type_ID
and u.user_ID = c.user_ID
and c.contract_name = 'Pay as you go';
如果我单独查询 select 查询,我会得到预期的结果,但是,一旦将行插入 table,所有值都是 0。
感谢您的帮助!
尝试 table var
中的数据类型 numeric(18,2)
我正在尝试将包含列乘法的子查询的值插入 table。这非常有效,但是如果我查询 table,它只有 0 个值。有人知道为什么吗?
我的查询是:
create table user_payments
(payment_stream number(4));
insert into user_payments (payment_stream)
select ct.min_price*s.stream_min as payment_stream
from users u
, streaming s
, content_type ct
, contract c
, media_content mc
where u.user_ID = s.user_ID
and mc.media_content_ID = s.media_content_ID
and ct.content_type_ID = mc.content_type_ID
and u.user_ID = c.user_ID
and c.contract_name = 'Pay as you go';
如果我单独查询 select 查询,我会得到预期的结果,但是,一旦将行插入 table,所有值都是 0。
感谢您的帮助!
尝试 table var
中的数据类型 numeric(18,2)