http://www.perlmonks.org?node_id=495056


in reply to Re: SQL GROUP BY Clause
in thread SQL GROUP BY Clause

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^3: SQL GROUP BY Clause
by reasonablekeith (Deacon) on Sep 26, 2005 at 11:28 UTC
    The order of the grouping should be alphabetical, as this is how SQL databases store their data internally.

    However, this is not always true for multi-processor systems, as they can group things simultaneously, so the order is not as important.

    hope this helps.

    UPDATE:

    Sorry guys and galls. The above to statements are untrue (well, I made them up, I guess they’re untrue).

    lex opened his first post with the salutation "Dear Monks", and felt the need to post that his question wasn't homework. To my mind, this tells me that he's not a perlmonks newbie, so he knew how this question was going to be received, but he still asked it. He even followed it up with another request for information, without showing he’s done anything to help himself.

    My response was supposed to be believable to any one who read it, but didn’t actually _read_ it. I have to admit I enjoyed a moment of guilty pleasure thinking he might copy it down verbatim on his homework sheet.

    You might say that's not in the spirit of this site, but neither is the question, or his disregard of the time other people put in to answering it. Anyway, votes count, and I'm minus 6 for this post (my first-ever down voted node) so it shall avoid attempts at comedy in the future.

    ---
    my name's not Keith, and I'm not reasonable.
      Can you point out evidence/docs for these claims? I've never heard such before, and I rather doubt they're true. Also this appears to have little relevence to the order the grouping fields are in.

      C.

      There's a difference between being unhelpful and being intentionally misleading. Given the OPs obvious lack of understanding as to how SQL and DBMSs work, I frown upon the latter. I understand it as a joke, however I have the benefit of knowing what's going on. Not everyone does.

      thor

      Feel the white light, the light within
      Be your own disciple, fan the sparks of will
      For all of us waiting, your kingdom will come

      I believe you should resist the urge of answering a clear homework question, as this node says.

      However, if you really must, at least check that you are answering the right question. Which was about the order of columns in a GROUP BY clause, not the order of values in the result set.

      Howdy!

      I missed the smiley.

      Those statements are so wrong on so many levels that it is difficult to make any sense of them. "Authentic frontier gibberish" comes to mind (c.f. Gabby Johnson), except it isn't even funny.

      yours,
      Michael
      With respect to your update, count me as one of the people who downvoted you. I wouldn't have had it been made obvious that it was a joke. Something as simple as "/joke" or <tongue location="cheek"> </tongue> would have sufficed. I appreciate humor...probably more than most. I do draw the line at potential miseducation. Remember, over the internet, people can't see a stiffled smile, nor can they read the tone in your voice. Given your update, I wish I could revoke my -- vote.

      thor

      Feel the white light, the light within
      Be your own disciple, fan the sparks of will
      For all of us waiting, your kingdom will come