你认为应该怎么写leftjoin后 然后怎么办? 

解决方案 »

  1.   


    文章表 a  id  title content   cid  回复表b  cid  contentselect a.title,a.content,b.content from a left join b a.cid=b.cid仅供参考 没考虑任何 需求和优化
      

  2.   

    你可以查询两次
    1.查询文章id=1的明细
    select * from article where id=12.查询文章article_id=1的回复
    select *from comment where article_id=1大概是这么个意思,供参考
      

  3.   

    select a.title,a.content,b.content from a left join b on a.cid=b.cid
    看红色部分
      

  4.   

    我能不能不要2次 我这个要发给客户端呢 我用leftjoin后 怎么渲染呢
      

  5.   


    这个2次查询效率高点,left join 完全没有必要,你不是还有php的么,在php变量里面拼接