是否可以将Mysql查询和子查询转换为web2py?

是否可以将Mysql查询和子查询转换为web2py?,sql,select,web2py,data-access-layer,Sql,Select,Web2py,Data Access Layer,Python和Web2py的新特性。难以转换为DAL select t.id, t.gp_pro_id, t.gp_historicdate from course t where t.gp_historicdate = (select MAX(a.gp_historicdate) from course a where a.id = t.id) 任何帮助都将不胜感激。我只是不想使用executesql,但如果无法翻译,我会这样做 谢谢 小菜一碟 db(db.course.gp_hist

Python和Web2py的新特性。难以转换为
DAL

select t.id, t.gp_pro_id, t.gp_historicdate 
from course t where t.gp_historicdate = 
(select MAX(a.gp_historicdate) 
from course a where a.id = t.id)
任何帮助都将不胜感激。我只是不想使用
executesql
,但如果无法翻译,我会这样做

谢谢

小菜一碟

db(db.course.gp_historicdate == db.course.gp_historicdate.max()).select(db.course.id, db.course.gp_pro_id, db.course.gp_historicdate)

您能详细介绍一下
课程表的结构吗?