AnsweredAssumed Answered

Execute sql Referencing Current table

Question asked by Hudi on Dec 7, 2012
Latest reply on Dec 10, 2012 by Hudi

Quick SQL question that I've already spent too much time trying to fix.


I'm trying to get the sum of all Invoices (Example) for a particular salesman into INVOICES::Salesman_sum.


The field INVOICES::salesman_sum has this calculation:


ExecuteSQL ( "SELECT SUM("Invoice_Total") FROM "Invoices" WHERE "Sales_id" = ? "

; "" ; "";Invoices::Sales_id )



I'm getting errors when tryign to run this from the INvoices table.


The odd thing is that if I run this calculation from a field in the Salesman table it works fine.

Basically, can you use sql queries on data in the current table, using arguments in the same table.


I hope I've explained this accurately, thatnks for all your help