On 26 Oct 2006, at 19:52, alternate_dph wrote:

> Anyways, here's the query that's giving me
> duplicates:
>
> $random_questions_query = "SELECT DISTINCT tgs_questions.q_id
> FROM tgs_questions, tgs_quest_ans
> WHERE tgs_quest_ans.q_id = tgs_questions.q_id
> ORDER BY RAND() LIMIT 0, 5";


I'm wondering why you would keep the questions & answers in separate  
tables?
Seems like an over complication for a simple question/answer scenario.

table: t_questions
"id", "question", "answer"

SELECT DISTINCT question FROM t_questions
WHERE answer IS NOT NULL
ORDER BY RAND() LIMIT 5

--
Riquez

[Non-text portions of this message have been removed]



Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/php-list/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to