calculations

A place for users and developers of the Xataface to discuss and receive support.

calculations

Postby Martin Pruss » Wed Mar 18, 2009 5:16 am

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
Martin Pruss
 
Posts: 61
Joined: Tue Oct 23, 2007 2:22 pm
Location: Berlin

Postby shannah » Wed Mar 18, 2009 8:26 am

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
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby Martin Pruss » Wed Mar 18, 2009 8:37 am

Thanks ...
already tested and works like a charm...
have a nice day
cheers
martin
Martin Pruss
 
Posts: 61
Joined: Tue Oct 23, 2007 2:22 pm
Location: Berlin


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 15 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved