Jump to content

query help


RyanSF07

Recommended Posts

Hi All,

 

I have a several hundred "quizzes" in a database that I need to go through. All of the quizzes are multiple choice and based on a video.

 

Typically I go through these one by one. Over the past few months I haven't been as diligent and the quizzes have piled up for moderation.

 

I was going through this morning and quickly saw that most of these (they are User Generated) don't have more than 2 questions. That is, quite a few of them appear to be 'test' quizzes by users.. just to see how the quiz builder works.

 

Anyhow, if they are good quizzes / quality content I push them to the site. If not I disable them.

 

I need help with a sql query -- I'd like to run this in php my admin and view all quizzes with 2 questions or less and with a "pass text" set to "new_quiz".

 

Then I plan to update the "new_quiz" value to "disabled" to remove them from the moderation cue.

 

Here's how I pull the video from the database:

"SELECT * FROM video, registered_users WHERE video.id = '$_GET[id]' AND video.user_id = registered_users.id";

 

Here's how I pull quizzes/questions from the database:

$display = mysql_query("SELECT * FROM quiz WHERE quiz.video_id = '$_SESSION[get]' ORDER BY id ASC");

 

Questions are in the quiz table in a row called "question"

 

Could you please offer some help as to the best way to write this query?

 

In plain speak I think it ought to be:

select * from table-video and table-quiz where video.id = quiz.video_id and video.pass_text= "new_quiz" and there are equal to or less than 2 questions related to this video.

 

What is the best way to write this? Please help and I'll test the query on backup db.

 

thanks so much!

Ryan

Link to comment
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.