Hi Guys,
I need your help to create query dynamically,
how to populate data value from formula in other table.

Sample Below

Table A 
ID   Amount 
1    50 
2    40 
3    50 

Table B 
ID   FormulaID   VALUE 
X    1+2+3 
Y    1-2+3 

Result Expectation 
ID   FormulaID   VALUE 
X    1+2+3           140 
Y    1-2+3            60 

Thanks

I think you need a better design to do what you want.
For a start referring to the amount's by the ID when the ID is a number is immediately confusing. A + b + C makes far more sense.
But, regardless, stripping the equation apart to insert the values from the other table is always goingt o be tricky.

Can you pull the values and equation from the db and then do your transformation in code instead?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.