Thanks Anthony, That syntax works and I can use that to refer to the data, I could see that a row object had an '_extra' dict for the selected expressions but could not see that the data could be referred to be the name of the expression 'mysum' (its in there somewhere but not sure where!!)
On Feb 26, 4:40 pm, Anthony <[email protected]> wrote: > I'm not sure you can do that. In order to access the mysum column in the > result, you would do: > > row[mysum] > > Anthony > > > > > > > > On Sunday, February 26, 2012 11:05:59 AM UTC-5, Paul wrote: > > > In the dal I'm selecting two summed fields and adding them together, > > the column name in the set object ends up being called > > '(SUM(t_appointment.miles_to) + SUM(t_appointment.miles_from))', how > > would I define the dal query to get an better column name (e.g. > > total_miles) ? > > > Current query is: > > > def mileage(): > > mysum = db.t_appointment.miles_to.sum() > > +db.t_appointment.miles_from.sum() > > groupyyyymm = db.t_appointment.f_start_time.year()| > > db.t_appointment.f_start_time.month() > > rows = db().select( > > mysum, > > db.t_appointment.f_start_time.year(), > > db.t_appointment.f_start_time.month(), > > groupby=groupyyyymm) > > > return dict(rows=rows, sql = db._lastsql) > > > Thanks, > > > Paul

