Jump to content

fenway

Staff Alumni
  • Posts

    16,168
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by fenway

  1. You can't just randomly pick whatever columns you want when using group by -- member isn't a "valid" option here. You'll need to join back to the table once you're found the "max" record to get the remaining details.
  2. No, it's because the comma operator and JOIN don't have the same precedence in v5. Moral of the story -- NEVER EVER EVER use the comma operator -- EVER. It's only 3 extra characters to do it properly. In the meanwhile, wrapping the "comma-separated" list of tables in parens will "solve" your problem -- see below. SELECT p.products_id, p.products_image, p.products_tax_class_id, if( s.status, s.specials_new_products_price, p.products_price ) AS products_price FROM (products p, products_description pd, products_to_categories p2c, categories c) LEFT JOIN specials s ON p.products_id = s.products_id WHERE products_status = '1' AND p.products_ordered >0 AND p.products_id = pd.products_id AND pd.language_id = '1' AND p.products_id = p2c.products_id AND p2c.categories_id = c.categories_id AND '0' IN ( c.categories_id, c.parent_id ) ORDER BY p.products_ordered DESC LIMIT 10
  3. You have to figure out who is logged in somehow -- I assume you're storing that somehwere.
  4. This is a php issue....
  5. Like this: $sql = mysql_query("SELECT count(*) FROM tbl_maillist_users WHERE ListsID='$ListsID' AND Status='Active'") or die(mysql_error()); $users = mysql_result($sql, 0, 0);
  6. Look at LOAD DATA INFILE... you can specify tab-separated.
  7. The answer is "no" -- what's wrong with a union?
  8. "required info"? what is that?
  9. So use a LEFT JOIN, and COALESCE() the value.
  10. Well, let's see, we have no idea what the query is....
  11. Well, you'll need to pull back some from the session (cookie, session_id, whatever).
  12. NO NO NO.... you're retrieving ALL the rows in each table just to get a simple count! The answer was provided above.
  13. First, you need to get the most recent timestamped "thing"... then you need to join it back.
  14. You need to use UNION... not a JOIN.
  15. How about echo-ing the sql statment?
  16. No problem... so, for the record, which index worked???
  17. You can... but not on binary data, only character data.
  18. Why do you have *two* select statements???
  19. That depends... what id are we talking about?
  20. Ignoring the obvious design flaw here, the issue is that you can't use a dynamic column list in sql
  21. What's wrong the mysql refman?
  22. Switch to proper JOINs... then LEFT JOIN to the highlight table on ( user_id ), and use IFNULL() to check.
  23. You can't filtered on LEFT JOIN'ed results -- move that condition to the on clause.
  24. 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.
×
×
  • 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.