Results 1 to 2 of 2

Thread: Left outer join

  1. #1
    Join Date
    Nov 2010
    Posts
    2

    Unanswered: Left outer join

    This SQL operation will get the desired Proposal_ID.
    Code:
    SELECT P.Proposal_ID, 
    AVG(c.Task_Good_Idea) AS Average 
    FROM proposals P, 
    proposal_appraisal c 
    LEFT OUTER JOIN users b 
    ON (c.Evaluator_ID = b.User_ID) 
    LEFT OUTER JOIN submission_status d 
    ON (c.Primary_Evaluation_Status_ID = d.submission_status_ID) 
    WHERE (P.Proposal_ID = c.Proposal_ID) 
    AND P.Proposal_ID >= 931 AND d.Submission_Status_ID = 2 
    GROUP BY Proposal_ID 
    HAVING Average >=25
    How to modify the following SQL operation so that only desired Proposal_ID are used?
    Code:
    select cfp_Id, P.proposal_id, P.institution_Name, sum(P.Task_Good_Idea + P.Task_Involve_Youth + P.Task_Involve_Partnerships + P.Task_Exploit_Digital_Medium + P.Task_Value_For_Money + P.Task_Theme + P.Task_Skills_Development + P.Task_LOC_Curriculum) as Task_Good_Idea
    from proposals P 
    group by P.proposal_ID 
    having (Task_Good_Idea >= 25) and (cfp_Id = 22) 
    order by P.proposal_id desc

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    what is the primary key of the proposals table?
    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
  •