cancel
Showing results for 
Search instead for 
Did you mean: 

help query

Former Member
0 Kudos

I have this query

Select t0.campo1, t0.campo2, (select t10.campo1 / 5 * 2,5 from FILE10 t10 ON t10.campo1 = t0.campo1) 'Value 1', campo2 * (select t10.campo1 / 5 * 2,5 from FILE10 t10 ON t10.campo1 = t0.campo1) 'Value 1b'

from FILE1 t0

can I use a variable to avoid the two subqueries?

thanks

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member204969
Active Contributor
0 Kudos

Try something like this:

Select t0.campo1, t0.campo2,
 t10.campo1 / 5 * 2,5 'Value 1',
 campo2 * (t10.campo1 / 5 * 2,5 ) 'Value 1b'
from FILE1 t0 inner join FILE10 t10 ON t10.campo1 = t0.campo1

Former Member
0 Kudos

my problem is,

I do not want to repeat many times the subquery but to use a field with the result of the subquery,

Former Member
0 Kudos

Hi,

Looks like you are using comma for decimal. Is that right?

Thanks,

Gordon