e2

滴滴侠,fai抖

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

模板:

        SELECT
        b.BookId AS bookId,
        b.BookName AS bookName,
       (select group_concat(aa.bookTypeName) from (SELECT bt.bookTypeName AS bookTypeName,b.bookId AS bookId
         FROM
         wor_booktype AS bt
         left join wor_book_booktype AS bb ON bt.BookTypeId = bb.BookTypeId
        left join wor_book AS b ON bb.BookId = b.bookId) AS aa where aa.BookId = b.BookId)  AS bookTypeNames,
        b.BookIsSign AS bookIsSign,
        b.UpdateCycle AS updateCycle,
        b.BookReviewStatus AS bookReviewStatus,
        b.UserId AS userId,
        b.Sort AS sort
        FROM
        wor_book AS b
        left join
        wor_book_booktype AS bb ON bb.BookId = b.BookId
        left join
        wor_booktype AS bt ON bt.BookTypeId = bb.BookTypeId
        where b.IsHide NOT IN ('1')
        GROUP BY
        b.BookId
        ORDER BY FIELD(b.BookReviewStatus,'已审核','审核中','未审核','已下架')

 

结果:

 

posted on 2017-06-15 20:07  纯黑Se丶  阅读(87)  评论(0编辑  收藏  举报