clde
clde

Reputation: 219

SQL Insert values with subquery and column multiplication

I am trying to insert a value with a subquery including a column multiplication into a table. This works perfectly, however if I query the table, it only has 0 values. Does anybody know why?

My queries are:

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';

If I query the select query individually, I get the expected outcome, however, once the rows are inserted into the table, all values are 0.

Thanks for your help!

Upvotes: 0

Views: 721

Answers (1)

mg3
mg3

Reputation: 131

try datatype numeric(18,2) in table var

Upvotes: 1

Related Questions