我有一个子查询表inner_stmt
,我想用表revisions
加入。但是revisions.join()
会出现以下错误:
Neither 'Label' object nor 'Comparator' object has an attribute 'c'
这是我的代码。我做错了什么?
inner_stmt = select([
ratings.c.article_name,
func.min(ratings.c.timestamp).label('mintime')]) \
.group_by(ratings.c.article_name).label('firstga')
stmt = select([
revisions.c.article_id,
func.max(revisions.c.length_bytes)]) \
.select_from(revisions.join(
inner_stmt,
revisions.c.article_name == inner_stmt.c.article_name)) \
.group_by(table.c.article_id)