Click here to Skip to main content
15,916,042 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Field1                pcnt1             pcnt2         pnct3
Pcnt1*pcnt3                18                  20           5
pcnt2                      15                  10          30
pcnt1(pcnt2*pcnt3)          10                  20          15


result:

Field1                     pcnt1               pcnt2            pcnt3
18*5                         18                  20                5
10                           15                   10                30
10(20*15)                     10                  20                15


What I have tried:

was trying using case statement but getting value only for single field name also hard coded. so couldn't get much. please help.
Posted
Updated 20-Mar-16 5:24am
v3
Comments
Tomas Takac 20-Mar-16 3:48am    
I would suggest you do something like this in your application layer. If you must do it in the database then you need to use dynamic SQL. What database are you using?
RickZeeland 25-Mar-16 14:05pm    
And ? have you fallen asleep ? did you try any of the suggestions ?

1 solution

Something like this:

JavaScript
SELECT REPLACE(REPLACE(REPLACE([Field1],'pcnt1',[pcnt1]),'pcnt2',[pcnt2]),'pcnt3',[pcnt3])
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900