MySQL Forums
Forum List  »  Newbie

Query Structure
Posted by: Debbie Foley
Date: May 30, 2018 01:51PM

I have a table in my structure called notes. In it, I can retrieve general notes on a project and budget notes. The connection is a primary key field that identifies if you are retrieving a budget note or general note. I can't seem to get the query to execute. It continually times out. What am I missing? I have tried these as just links to the table and as derived tables. Any help to point me in the right direction would be appreciated. Please note that I am pulling a large volume of project data but even just pulling these few fields is not working. Thank you for reviewing. My code is below:

SELECT
proj._ka_osr_num AS OSR,
GenNotes.Notes

FROM
proj

LEFT JOIN
(SELECT
proj.__kp_proj_id,
notes.text

FROM
proj

LEFT JOIN
notes ON notes._kf_proj_id_budg = proj.__kp_proj_id

GROUP BY
proj.__kp_proj_id,
notes.text
) BudNotes ON BudNotes.__kp_proj_id = proj.__kp_proj_id

LEFT JOIN
(SELECT
proj.__kp_proj_id,
notes.text AS Notes
FROM
proj
LEFT JOIN
notes ON notes._kf_proj_id = proj.__kp_proj_id
) GenNotes ON GenNotes.__kp_proj_id = proj.__kp_proj_id

GROUP BY
proj._ka_osr_num

Options: ReplyQuote


Subject
Written By
Posted
Query Structure
May 30, 2018 01:51PM
May 30, 2018 02:20PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.