Answered Query A Table Twice in a DataSet

  • Wednesday, December 12, 2012 10:47 PM
     
     

    I am trying to query a single table and return two sets of data into two columns for a report.

    the table in question (tblReviewComments) looks something like this:

    Key - ReviewCommentTypeID - PlainText
    001 - 15 - "Text of Comment type 1"
    002 - 10  - "Text of Commen type 2"

    I am trying to return a distinct colum for each type of comment.

    The complete query as is can be filtered to show any of the comment types.

    SELECT
      tblReview.ReviewName
      ,tblReview.ReviewDate
      ,tblReviewBorrower.BorrowerName
      ,tblReviewBankInfo.BusinessDesc
      ,tblReviewNote.TotalCommitment
      ,tblReviewComment.ReviewCommentTypeId
      ,tblReviewComment.PlainText
    FROM
      tblReviewBorrower
      INNER JOIN tblReviewBankInfo
        ON tblReviewBorrower.ReviewBorrowerId = tblReviewBankInfo.ReviewBorrowerId
      INNER JOIN tblReviewNote
        ON tblReviewBorrower.ReviewBorrowerId = tblReviewNote.ReviewBorrowerId
      INNER JOIN tblReview
        ON tblReviewBorrower.ReviewKey = tblReview.ReviewKey AND tblReviewNote.ReviewKey = tblReview.ReviewKey
      INNER JOIN tblReviewComment
        ON tblReviewBorrower.ReviewBorrowerId = tblReviewComment.ReviewBorrowerId AND tblReview.ReviewKey = tblReviewComment.ReviewKey


    • Edited by Toby Ellis Wednesday, December 12, 2012 10:47 PM
    •  

All Replies