Jump to content

fenway

Staff Alumni
  • Posts

    16,168
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by fenway

  1. You can't use an aggregate expression in the WHERE clause -- move it to HAVING.
  2. Sounds like you could just UNION the appropriate tables.
  3. When you say "row number", do you mean the auto-increment column? It won't get re-used unless you truncated the table.
  4. Not "parents", parens -- parentheses. You can't mix ANDs and ORs that way, since they have the same precedence -- you need to group all of the ORs together.
  5. Yes, you need to JOIN the tables -- the speed will be depending on the indexes you choose and your version of mysql. Easiest way to handle this is simply to UNION the various options: ( select * from table2 inner join table1 on ( table1.column1 = table2.column1 ) where table1.status = 1 ) UNION DISTINCT ( select * from table2 inner join table1 on ( table1.column1 = table2.column2 ) where table1.status = 1 ) UNION DISTINCT ( select * from table2 inner join table1 on ( table1.column2 = table2.column1 ) where table1.status = 1 ) UNION DISTINCT ( select * from table2 inner join table1 on ( table1.column2 = table2.column2 ) where table1.status = 1 ) Of course, this makes me question your design.
  6. Huh?
  7. Define "working".
  8. TLDR... what's wrong with that query?
  9. Actually, that's precisely what I suggested.
  10. You're missing parens.
  11. There is no "update from".
  12. Change the default for that column with ALTER.
  13. Then don't add them to the query -- don't blame mysql for executing a query that you type.
  14. I'd hope there was an ODBC interface.
  15. fenway

    SQL Quitting

    What's that a log of?
  16. I see no reason why not, as long as it's not recursive.
  17. Not a chance that anyone but you can read through that.
  18. Moving it to the DB should be the last step, if at all.
  19. Yikes. Why not Availability.*?
  20. So it's not using any indexes, eh?
  21. The lazy way is to use a bunch of ORs, and check a count in the having clause. I prefer to cross join the table to itself, one for each condition.
  22. Why would you even want to?
  23. Basically, it depends on what's causing the error -- if you're getting php errors, it's not mysql's fault.
×
×
  • 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.