You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
这条SQL语句是不是有问题呀, photo没有tag_id字段, 是不是因该改成SELECT tag.* FROM tag JOIN tagging ON tag.id = tagging.tag_id JOIN photo ON photo.id=tagging.photo_id. 还有一点想问如果我把tagging修改为关联模型, 我是不是可以直接从tagging查找热们标签.而不是用join.大概就是Tagging.query.group_by(tagging.tag_id).order_by(func.count(tagging.photo_id).desc()).limet(10)
之后对查询出来的tagging在模板中分别使用tag关联属性(在建立模型的时候添加relationship)是不是也能实现相同的功能.
The text was updated successfully, but these errors were encountered:
这条SQL语句是不是有问题呀, photo没有tag_id字段, 是不是因该改成SELECT tag.* FROM tag JOIN tagging ON tag.id = tagging.tag_id JOIN photo ON photo.id=tagging.photo_id. 还有一点想问如果我把tagging修改为关联模型, 我是不是可以直接从tagging查找热们标签.而不是用join.大概就是Tagging.query.group_by(tagging.tag_id).order_by(func.count(tagging.photo_id).desc()).limet(10)
之后对查询出来的tagging在模板中分别使用tag关联属性(在建立模型的时候添加relationship)是不是也能实现相同的功能.
The text was updated successfully, but these errors were encountered: