Jump to content

fenway

Staff Alumni
  • Posts

    16,168
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by fenway

  1. Assuming you have root access to the box, just --skip-grants.
  2. WHERE comes before GROUP BY. And use COUNT(*).
  3. If you are well-versed in php, a simple if/else will do.
  4. I've edited your post -- all we need to see is the query. You need something along the lines of "WHERE yourDateTimeField >= NOW() - INTERVAL 5 DAY". If you only want the dates, and not the times, you can use DATE() on the datetime field.
  5. What do you mean "a lot"? I see 2.
  6. You'll need to start a query with SELECT; and then alias those tables.
  7. Afraid how? If you know for certain that each of the sub-selects will only return a single row, then just switch the word UNION to "JOIN".
  8. You have to build your where clause dynamically.
  9. One row means JOIN, not UNION.
  10. Of course, assuming you're LEFT or INNER JOIN-ing, you only the need the column on the "right" table indexed.
  11. You're copying value & username from table1 to table2.
  12. And INSERT INTO... SELECT WHERE would work. But, again, why are you duplicating data?
  13. Well, you can order by if the first character is alpha or digit.
  14. You should never do that. First, you should always explicitly list your column names. Two, you should leave out the auto-increment column. Three, why are you copying data?
  15. They should all say "ref" or "eq_ref" -- you need to an index for every column that you're using in ON conditions.
  16. No, MYSQL's REGEXP -- you can determine if your values are all digits or not.
  17. OK -- well, the only thing I see wrong with the EXPLAIN if that you're missing some key indexes for the JOINs.
  18. I don't see any queries in that code.
  19. Why do you need to insert blank?
  20. fenway

    query help..

    INNER JOIN requires both sides of your ON clause to match.
  21. You can use the boolean result of REGEXP.
  22. So you're just trying to caculate each person's score. But is this query supposed to calculated EVERYONE's score, or just the one person's?
  23. This topic has been moved to PHP Coding Help. http://www.phpfreaks.com/forums/index.php?topic=345756.0
  24. fenway

    query help..

    Well, a NULL into a non-null decimal field would return 0.00.
  25. And why the UNION -- are you actually running this once per UID?
×
×
  • 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.