1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Stupid stupid query!!

Discussion in 'XenForo Development Discussions' started by Marc, May 10, 2011.

  1. Marc

    Marc Well-Known Member

    Please could someone help me out here. Got a query which when run in phpmyadmin kills the server.... Need to get the info, but not sure how to optimise it more. For someone who programs with sql server every day of his life, I feel pretty stupid at the moment LOL.

    SELECT
    post.user_id,
    post.post_id,
    thread.thread_id,
    thread.title AS thread_title,
    thread.node_id,
    node.title AS forum_title,
    user.username
    FROM xf_thread as thread
    LEFT JOIN xf_post AS post ON post.last_post_id = post.post_id
    LEFT JOIN xf_node AS node ON(node.node_id = thread.node_id)
    LEFT JOIN xf_user AS user ON(user.user_id = post.user_id)
    WHERE NOT ISNULL(thread.thread_id)
    AND thread.discussion_state = 'visible'
    ORDER BY thread.last_post_date DESC
    LIMIT 10
     
  2. Shaun Mason

    Shaun Mason Active Member

    Do you mean thread.last_post_id in the first JOIN?
     
    Marc likes this.
  3. Marc

    Marc Well-Known Member

    AHHHHH BO******* ...... guess that might be it then LOL
     
    thewizard likes this.
  4. Marc

    Marc Well-Known Member

    Shaun your a star ....... query took 0.0006 sec LOL .... bit better than a never ending loop on insane rubbish lol

    If I could 'Like' twice .... I would LOL
     
  5. Shaun Mason

    Shaun Mason Active Member

    Sometimes you just need a new set of eyes.
     
  6. Marc

    Marc Well-Known Member

    Indeed we do LOL ..... In fact most days I could do witha fresh pair :D lol
     

Share This Page