Jump to content

Recommended Posts

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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.