⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

sums and group by for list view



Captain Paralytic
  • profile picture
  • Member

Posted 24 November 2012 - 14:28 PM

Hi there,

I have tables thus:
Shoots
Models
Locations
Staff
Shoots_Models

The Staff table, Locations table and the Models table each has a Fees column.

The table shoots has foreign keys into Staff for its columns, producer, hair, assistant, editor, ...
It has FKs into the Locations table for the location.

The relations table Shoots_Model links models to the shoot.

In the List View for Shoots, I need to have field showing the total cost of the shoot, obtained by summing the fees values for the various staff members plus the accumulated cost of all the models.

I know I could run multiple queries in a callback_column function as suggested here: http://www.grocerycr...-join-relation/ but it would be far more efficient if it could all be done in a single database call. The query is simple enough, but how to manage it through grocerycrud and still have it support the add/edit forms?