Hello everybody!

I really need help with a query I'm trying to execute in Web2Py DAL
is there a way to use an inline table in the FROM field of a query?

this is my query:


SELECT SUM( HoursWorked / DayHoursSum ) AS DaysWorked
FROM `Tasks_TimeLog` H, (

  SELECT TheDate, User_id, SUM( HoursWorked ) AS DayHoursSum
  FROM `Tasks_TimeLog`
  GROUP BY TheDate, User_id
)S
WHERE H.User_id = S.User_id
AND H.TheDate = S.TheDate
AND Task='2'
GROUP BY Task

this is the inline table in Web2py:

inlineTable=db()._select(db.Tasks_TimeLog.TheDate,db.Tasks_TimeLog.User_id,db.Tasks_TimeLog.HoursWorked.sum(),groupby=db.Tasks_TimeLog.TheDate|
db.Tasks_TimeLog.User_id)

how do I use the inline table in my full query??

rows=db(db.Tasks_TimeLog.Task=='2'.....).select(.....,groupby=db.Tasks_TimeLog.Task)

Thanks to all the helpers!!



Reply via email to