Jump to content

fenway

Staff Alumni
  • Posts

    16,168
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by fenway

  1. You're asking about getting the top N records for a given group -- I've covered that many times before on this board.
  2. That's not a job for GROUP BY. Join the table to itself, on (id), and use t1.date > t2.date in the ON clause. Simple as that.
  3. What do you have so far?
  4. What doesn't work is getting back non-group-by fields.
  5. That's up to your script in PHP.
  6. Clearly, you're not searching the forums -- http://www.phpfreaks.com/forums/index.php?topic=342584.0.
  7. This topic has been moved to PHP Coding Help. http://www.phpfreaks.com/forums/index.php?topic=342915.0
  8. And you should really include the column list.
  9. What do you want to insert? How is it 3?
  10. No, I mean the user variables. And you should be able to order it however you'd like in the final order by clause.
  11. In the sticky for this board, there are alternatives.
  12. I don't follow.
  13. First, those variables aren't doing anything in this query. Second, the order by clauses inside each select aren't doing anything either. Sort at the very end, after the UNION.
  14. Not every product has 100s of categories.
  15. Actually, just the one query, and it's EXPLAIN output, as specified in the board's sticky.
  16. fenway

    NOW()

    The difference between the functions on invalid dates isn't.
  17. I don't follow. INSERT doesn't update.
  18. What's too hard to implement -- one query?
  19. What if some of the colours match?
  20. When you use BINARY, you negate index usage.
  21. If you have to attach a script, that means it's too big. It's too big because you're trying to post the entire thing. I already told you not to use great circle distances -- and you ignored me.
  22. It says there are only 11 rows total -- is that true?
  23. This has to stop -- php syntax errors have no place on this forum, especially not one at a time. Post your CREATE TABLE so we can see what collation you're using.
  24. fenway

    NOW()

    That's exactly what I'm saying -- it's undocumented, and it's evil.
  25. I'm hoping there's a WHERE clause that goes along with that UPDATE. Back to your question -- it really depends on how "something" changes elsewhere in your application.
×
×
  • 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.