Jump to content

fenway

Staff Alumni
  • Posts

    16,168
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by fenway

  1. fenway

    [SOLVED] MAX()

    No, it won't work. This is the MOST common question asked on this forum. What you have to remember is that using "group by" means that mysql throws away every other column in the table -- and just tallies the results of the aggregate function you requested, like MAX, COUNT, etc. That means that you CANNOT get back any other columns at the same time... you'll need another query. The human brain does this in two steps as well, you just don't notice: you find the max value by looking at every row ONCE, and THEN you find the matching username by looking at every row AGAIN to find that one with the max value. So: SELECT t1.game_id, t1.score, t1.username FROM arcade_stores AS t1 INNER JOIN ( SELECT game_id, MAX(score) AS score FROM arcade_scores GROUP BY game_id ) AS t2 USING ( game_id, score )
  2. Sorry, I thought you wanted to show the max from each one.
  3. A single table per user-anything is rarely a good idea.
  4. There's not really much you can do here... if they view an entire "group" of pictures, you can save yourself having to store each individual view, but otherwise, you're pooched.
  5. Great, but what version was it? Was the subquery is the issue?
  6. Hmm... this board won't let you upload large files... I think the limit is ~1MB.... how big is your table data? Also, is the more than one corrupt table? If you can't upload, I'll make a rare exception and will take a look if you send me an e-mail.
  7. Not at all. Use "ORDER BY ( yourField = 'TOYOTA' ) DESC, yourField ASC"
  8. Not true at all... like I said earlier, use column aliases to make them the same.
  9. How was this solved?
  10. So you want to pull levelid from table1 and herid from table2, and get all of those possible combinations?
  11. There are plenty of tutorials that cover this type of thing....
  12. No... I meant drop the INDEX, not the FIELD.
  13. Yeah, sphinx is usually the easier way to go.
  14. I believe you have to drop it, then re-create it... you can do this in a single pass with ALTER TABLE.
  15. Does sound like that, though the perms seem to be 777. Can you dump the data after deleting the index without trying to repair it?
  16. Easiest way is simply to use the same column aliases for both parts of the union.
  17. I would use COUNT(*) or mysql_num_rows() to make sure you're actually getting back duplicate rows... seems very strange to me.
  18. I think I've heard about a maximum row limit for select/updates from that app somewhere....
  19. So let me get this straight... you want all possible combinations of myid/herid from table1 and table2? That's not an issue....
  20. I just answered another post w.r.t. storing hierarchical data... using "parentID" fields means that it's impossible to do anything recursively without an SP.
  21. There's a great sticky that talks about hierarchical data storage
  22. Then be sure to explicitly link back to the original post if you truly feel that it's completely different
  23. Since you're outputting all the results anyway, use a php counter.
  24. The table prefix is not part of the field name that you will retrieve... in fact, it will probably have the name of the first half of the query.
  25. That's a very unusual problem indeed... is this occuring from phymyadim?
×
×
  • 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.