如何在小马 orm 中使用子查询进行查询
SELECT *
FROM child_table
WHERE child_table.masterno IN (SELECT masterno
FROM mastertable
WHERE mastertable.recorddate > SYSDATE -1)
换句话说。我想做类似的事情
master_result = target_model.mastertable.select()\
.filter(lambda mt: mt.recorddate > DATE)
output = target_model.child_table.select()\
.filter(lambda ct: ct.masterno in master_result)
我有错误
pony.orm.sqltranslation.IncomparableTypesError: Incomparable types 'int' and 'mastertable' in expression: ct.masterno in master_result
master_result 在哪里
print(type(master_result))
<'pony.orm.core.QueryResult'>