Jump to content

fenway

Staff Alumni
  • Posts

    16,168
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by fenway

  1. fenway

    SQL is rusty

    Show us your query.
  2. Well, at the very least, you can UNION the results of two seemingly identical queries, one for regular, another for video.
  3. Don't try and get both answers at the same time -- first, do it for the max.
  4. I have seen that article, but it uses an "ID" key which my table does not have. My data is from downloaded CSV files that I then import into my database. All the data is re-imported each time (the existing table is dropped, re-created, and the CSV data is then imported). Because game information is added to the CSV files all the time, many with the same date, keeping the IDs the same from import to import would not be guaranteed. I am looking for a solution that does not require the use of a key (or "ID") column. It should be possible to do it by finding each team's last N games based on date, since a team does not play more than one game on any particular date. Everything I have tried thus far, though, results on only the last N games total played, regardless of team. The ID is just a unique identifier -- any one you can come up with, including examining multiple fields, is equivalent.
  5. Have you considered this?
  6. If you're going to cross-post to different boards, please make sure that you post the solution here no matter what -- please don't just troll for answers and then run away.
  7. fenway

    img help

    First, you're talking about adding a picture, and you've shown a select. Second, any issue with your php code doesn't really belong in a MySQL forum.
  8. You'll probably want to add "WHERE c.uid <> c2.uid".
  9. See here -- this is a common question.
  10. Oh, please use an alias -- that's precisely what they're for.
  11. To be clear, neither of the above will work -- however, kickstart's solution will (as usual).
  12. There are some magical UDFs for regex -- but when it's simple, explicit is better.
  13. I don't see how FKs have anything to do with reports -- they're not usefully unless you're writing data, which I assume your report isn't.
  14. Like I said before -- you need to join the table to itself, and for a given date, find the row that has no greater time (for the max) and no earlier time (for the min).
  15. This is a common question -- I've answered it at least 100 times. First, you need to identify the row with min/max -- and then you need to join back to the main table.
  16. Depends if you're running in strict mode or not.
  17. This topic has been moved to PHP Coding Help. http://www.phpfreaks.com/forums/index.php?topic=349713.0
  18. I mean that you'll get an arbitrary row - the order of the rows examined by MySQL is totally arbitrary (in the sense that you can't guess what it will be). if you want a particular one of the rows updated, and not others, you'll need both ORDER BY and LIMIT.
  19. And without ORDER BY, LIMIT is basically random.
  20. I've heard nothing but horror stories about them.
  21. Covers: Part 1: Using the MySQL Improved Extension, mysqli Part 2: Using the MySQL Extension, mysql Part 3: Using the PDO Extension With MySQL Driver, pdo_mysql Part 4: Using the MySQL Native Driver for PHP, mysqlnd Tutorial is here.
  22. Well, a scalar subquery, that is.
  23. Hopefully this presentation will stay online at scribd... it's simply fantastic, probably the best I've come across in recent memory. At 220 slides, it's quite lengthy -- but the lessons learned are invaluable, so be sure to read all the way to the end. A MUST READ!!!! EDIT: This year's version of the presentation -- some really great stuff in here, particuarly about hierarchies.
  24. At the 2008 MySQL Conference and Expo, The Pythian Group gave away EXPLAIN cheatsheets (PDF).
  25. This resource covers a very broad range of topics... it's worth a look, though, especially if you're stumbling in the early stages of configuration.
×
×
  • 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.