Postgres 9.1+ database contains customers and product.
In customers table, customer price is described as sql expression in priceexpression column for every customer.
How to create price list from this data ?
I tried code below but got error since eval() is undefined.
create table customer
( id int primary key,
priceexpression text );
insert into customer values (1, 'price*0.95'),(2,'cost+12.0' );
create table product
( id char(20) primary key,
price numeric(12,4),
cost numeric(12,4) );
insert into product values ('PRODUCT1', 120, 80),('PRODUCT2', 310.5, 290);
select
customer.id as customer,
product.id as product,
eval(priceexpression) as price
from customer,product
This is ASP.NET MVC4 application.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…