I am new to SQL and just at a loss for why this piece of code won’t execute. I get know errors but I get no results. No matter how long I wait, the code just keeps processing. I know this problem probably has something to do with my specific database, but I was wondering if there are any overt errors.
Additionally, if it has to do with the call I am making in my database, how would I go about debugging this since I get no formal errors?
SELECT cr.COMMUNICATIONS_ID AS ANSWER_ID, cr.CONSUMER_ID as VIEWER_ID,
cr.ACTION_LOG_ID, nc.PARENT_COMMUNICATIONS_ID AS QUESTION_ID,
cirm.CONSUMER_RATING AS VIEWER_INTEREST,
cim.CONSUMER_INTEREST_EXPERT_ID AS DOMAIN
FROM (
SELECT 234 AS CONSUMER_ID, ACTION_LOG_ID, COMMUNICATIONS_ID
FROM consumer_action_log
WHERE COMM_TYPE_ID=4
) AS cr
JOIN network_communications AS nc ON
cr.COMMUNICATIONS_ID=nc.COMMUNICATIONS_ID
JOIN communication_interest_mapping AS cim ON
nc.PARENT_COMMUNICATIONS_ID=cim.COMMUNICATION_ID
JOIN consumer_interest_rating_mapping AS cirm ON
cr.CONSUMER_ID=cirm.CONSUMER_ID AND
cim.CONSUMER_INTEREST_EXPERT_ID=cirm.CONSUMER_INTEREST_ID;
The derived column in the subquery may be throwing MySQL off. Try this query instead for the same results