表1:user(用户)uid,uname
表2:article(文章)aid,uid,atitle
表3:tags(关键字)tid,aid,ttitle
我现在需要提取一个包含某个关键字的最新10篇文章
方案1:
select uid,uname,aid,atitle from article a join user u on a.uid=u.uid join tags t on a.aid=t.aid where ttiele='test' order by time limit 10;
方案2:select aid,uid,atitle,tid,ttitle from article a join tags t on a.aid=t.aid where ttiele='test' order by time limit 10;
然后循环根据每个UID取得uname
方案3:select aid,uid,atitle,tid,ttitle from article where aid in (select aid from taga where where ttiele='test')order by time limit 10;
然后循环根据每个UID取得uname或者大家给我想个其他的方案,谢谢