on 2011 Mar 03 6:53 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
my problem is,
I do not want to repeat many times the subquery but to use a field with the result of the subquery,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Looks like you are using comma for decimal. Is that right?
Thanks,
Gordon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
106 | |
8 | |
8 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.