SUM options doesnt work if column is lookup. I pick numbers from other table, but my column doesnt SUM them

Is it possible to solve this ?
Thanks
Code: Select all
case 'tableview':
$sum=sqlvalue("SELECT sum(LOOKUPTABLE.LOOKUPFIELD) from TABLENAME, LOOKUPTABLE where TABLENAME.FIELD = LOOKUPTABLE.id");
$header="<%%HEADER%%><script type=\"text/javascript\">
\$j(function(){
\$j('td.TABLENAME-FIELD').last().text(".$sum.").addClass('text-right');
});
</script>";
break;
Code: Select all
case 'tableview':
$sum=sqlvalue("SELECT sum(pasirinkimai.pasirinkimai) from dalyviai, pasirinkimai where dalyviai.sumoketa = pasirinkimai.id");
$header="<%%HEADER%%><script type=\"text/javascript\">
\$j(function(){
\$j('td.dalyviai-sumoketa').last().text(".$sum.").addClass('text-right');
});
</script>";
break;