How to convert Mysql query to web2py DAL

时间:2019-01-15 18:24:36

标签: python mysql sql web2py database-abstraction

I am new to web2py and I was wondering if it was possible to convert this mysql statement to web2py DAL. the dates are formatted as strings, It shows last day records of every month:

select * 
from table 
where STR_TO_DATE(date, "%d/%m/%Y") in 
( select max(STR_TO_DATE(date, "%d/%m/%Y")) 
from table
group by month(STR_TO_DATE(date, "%d/%m/%Y")), year(STR_TO_DATE(date, "%d/%m/%Y")) );

Any help will be much appreciated. I prefer to use dal over executesql but if it is not possible to translate then I will use executesql.

Thanks!

0 个答案:

没有答案