Page 1 of 1

calculations

PostPosted: Wed Mar 18, 2009 5:16 am
by Martin Pruss
Hi Steve
In my function block__before_main_table() I am querying like this: "select sum(km) from streak ..."
unfortunately the field "km"
is populated by this relative query:

[strecken_km]
__sql__ = "SELECT strecken_id, strecken_km FROM strecken ORDER BY strecken_id"

in the valuelist.ini

Now the first query calculates the Sum of the index fields of the valuelist.

even though that's nice, its not the Sum I need :cry:

Do you have any ideas how to calculate the right field?

cheers
Martin

PostPosted: Wed Mar 18, 2009 8:26 am
by shannah
You'll have to do a join then.

select sum(s2.stricken_km) from streak s1 inner join strecken s2 on s1.km=s2.strecken_id

PostPosted: Wed Mar 18, 2009 8:37 am
by Martin Pruss
Thanks ...
already tested and works like a charm...
have a nice day
cheers
martin