Announcement

Collapse
No announcement yet.

MySQL -ordering by max

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • MySQL -ordering by max

    Hello, I'm having code breakdown here
    Basically, I am trying to order data which have been split up into 3 categories, 1 2 and 3. Each hold multiple data sets apart from 1, so that is NULL.

    Here's my code:

    SELECT forum_categories . * , max( forum_answer.a_id )
    FROM forum_categories
    LEFT JOIN forum_question ON forum_question.catid = forum_categories.id
    LEFT JOIN forum_answer ON forum_answer.question_id = forum_question.id
    GROUP BY forum_categories.id, forum_categories.name
    However this
    Code:
    max( forum_answer.a_id )
    makes it so that only the replies are pulled out regardless of new threads.

    Any ideas on what I could do to make it so that it picks up the thread as well?

    PS, this is a code for a forum, but for an intranet where one has to be custom coded, not practical to integrate.
    Last edited by Shamil.; Sun 16 Aug '09, 4:50pm.
    Shamil Nunhuck, - Radon Systems Ltd.
    VPS + Dedicated Server Hosting and Management
    vBulletin Hosting and Services
    Server / Website Consultation

  • #2
    What does your query do? pulls the latest threads with the latest replies?
    while(true){
    if(
    $someone->needsHelp() && $i->canHelp()) $post->help();
    if(
    $i->findBug()) $post->bug();
    }

    Comment


    • #3
      Originally posted by Dody View Post
      What does your query do? pulls the latest threads with the latest replies?
      yep
      Shamil Nunhuck, - Radon Systems Ltd.
      VPS + Dedicated Server Hosting and Management
      vBulletin Hosting and Services
      Server / Website Consultation

      Comment

      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
      Working...
      X