一个热门文章分类,需要查询所有文章,过滤条件就是该文章所属分类允许被推到热门
首先通过cateid将Post表和Category表拼接起来,然后再判断是否可以推到hot
query = community.posts.join(Community_Category,Community_Category.id==Post.category_id).filter(Community_Category.be_hot==1)
一个热门文章分类,需要查询所有文章,过滤条件就是该文章所属分类允许被推到热门
首先通过cateid将Post表和Category表拼接起来,然后再判断是否可以推到hot
query = community.posts.join(Community_Category,Community_Category.id==Post.category_id).filter(Community_Category.be_hot==1)
本文标题:多表关联查询
本文链接:https://www.haomeiwen.com/subject/rpxlettx.html
网友评论