0

SQL to sum the sessions for only the current month

Hi,

I have this code behind a button and when I click it I want it to populate a table with various information (which is partially working)

 

let me := this;
for i in select Pupil do
let myInvoice := (create Invoice);
myInvoice.(InvoiceDate := now());
myInvoice.('Invoice Amount' := sum((select Pupil).i.'Pupil Attendance Detail'.'Chg £'));
myInvoice.(Pupil := i.Id)
end

I'm wanting the correct syntax so that it only sums the total for sessions for the current month (which is in a session date field in a class session table - the syntax is also incorrect as it's summing up multiple ties (depending on how many students I have) so I think the select statement needs to go outside of the loop.

Any thoughts / ideas?

 

Thanks

Reply

null

Content aside

  • 4 yrs agoLast active
  • 641Views