If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Left outer join

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-18-10, 13:17
albertkao albertkao is offline
Registered User
 
Join Date: Nov 2010
Posts: 2
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
Reply With Quote
  #2 (permalink)  
Old 11-18-10, 14:26
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
what is the primary key of the proposals table?
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On