Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2010
    Posts
    2

    Unanswered: select additional data

    Given the following two SQL operations:
    Code:
    select prod_Id, P.proposal_id, P.institution_Name 
    from proposals P 
    group by P.proposal_ID 
    having mark >= 50 
    order by P.proposal_id desc 
    
    
    select prod_id, P.proposal_id, PA.evaluator_ID, U.user_Given_Name, U.user_surname 
    from users U, proposals P 
    LEFT outer JOIN proposal_appraisal PA 
    ON (P.proposal_Id = PA.proposal_id) 
    where PA.evaluator_ID = U.user_id 
    group by prod_id, PA.evaluator_ID 
    order by PA.proposal_ID, U.user_ID desc
    How to modify the following SQL operation so that prod_Id will be selected in addition to the existing columns being selected:
    Code:
    select PA.proposal_id, PA.evaluator_ID, PA.Primary_Evaluation_Status_ID, PA.Secondary_Evaluation_Status_ID, U.user_Given_Name, U.user_surname, 
    from users U, proposal_appraisal PA 
    where PA.evaluator_ID = U.user_id 
    group by PA.proposal_id, PA.evaluator_ID 
    order by PA.proposal_ID, U.user_ID desc

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Code:
    SELECT PA.proposal_id
         , PA.evaluator_ID
         , PA.Primary_Evaluation_Status_ID
         , PA.Secondary_Evaluation_Status_ID
         , U.user_Given_Name
         , U.user_surname
         , P.prod_id
      FROM users U
    INNER
      JOIN proposal_appraisal PA 
        ON PA.evaluator_ID = U.user_id 
    INNER
      JOIN proposals P 
        ON P.proposal_Id = PA.proposal_id
    ORDER 
        BY PA.proposal_ID
         , U.user_ID desc
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •