Nodral Posted March 31, 2011 Share Posted March 31, 2011 Hi I have 3 tables in my DB which I am trying to interrogate. mdl_feedback_completed has columns id, feedback, userid, timemodified mdl_feedback_tracking has columns id, userid, feedback, completed mdl_feedback_value has columns id, course_id, item, completed, value. These tables are already set up as part of a Moodle installation and I cannot modify them. The query I am trying to run should select value from mdl_feedback_value depending on the timemodified field in mdl_feedback_completed. However, the query is timing out and I get a fatal error. Any ideas? $sql="SELECT mdl_feedback_value.value FROM mdl_feedback_value INNER JOIN mdl_feedback_tracking ON mdl_feedback_value.completed = mdl_feedback_tracking.completed INNER JOIN mdl_feedback_completed ON mdl_feedback_tracking.feedback = mdl_feedback_completed.feedback WHERE timemodified = 1301499189"; Link to comment https://forums.phpfreaks.com/topic/232275-inner-join-error/ Share on other sites More sharing options...
kickstart Posted March 31, 2011 Share Posted March 31, 2011 Hi The SQL looks OK and normally even with poor indexing I wouldn't expect it to be that slow. My guess would be that there should be more columns used to JOIN the tables together (e, maybe userid between mdl_feedback_completed and mdl_feedback_tracking), and without this you are landing up getting a massive number of records (very easy for it to be in the millions). All the best Keith Link to comment https://forums.phpfreaks.com/topic/232275-inner-join-error/#findComment-1194899 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.