Advertisement
fabi0

Untitled

Oct 25th, 2013
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.61 KB | None | 0 0
  1. SELECT DISTINCT
  2.         B.bid AS _bookId,
  3.         B.bname AS _bookName,
  4.         W.wid AS _writerId,
  5.         W.wname AS _writerName,
  6.         C.cid AS _commentId,
  7.         C.comment AS COMMENTS,
  8.         C.DATE AS _commentDate,
  9.         U.uname AS _userName,
  10.         U.uid AS _userID
  11.         FROM books_writers AS BW
  12.         JOIN books AS B ON B.bid = BW.bid
  13.         JOIN books_writers AS BW1 ON B.bid = BW1.bid
  14.         JOIN writers AS W ON BW1.wid = W.wid
  15.         LEFT JOIN comments AS C ON C.bid = BW1.bid
  16.         LEFT JOIN users AS U ON U.uid = C.uid
  17.         WHERE B.bid=?
  18.         ORDER BY _commentDate DESC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement