Jump to content

fenway

Staff Alumni
  • Posts

    16,168
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by fenway

  1. mysql_query() returns a resultset object, not the individual rows.
  2. See here.
  3. Show us your query
  4. If it's on a row-by-row basis, then you don't need to store each column individually -- that will simplify this problem immeasurably.
  5. That's the same query as from this topic? And you still didn't answer my question.
  6. Yup, you've got it -- join the tables, use SUM(payment), GROUP BY userID, and then order by the SUM(), DESC, LIMIT 5.
  7. Huh?
  8. Probably -- many records in the left table with non-matching rows in the right.
  9. If there are non-matching rows in the right table, then yes, it will retrieve more rows. It's not about slow -- it's about what you want to retrieve.
  10. The only reason to use LEFT JOIN is to get back records from factuur that don't have matches in bestelling.
  11. What are they doing with each individual value in each column? I'm trying to figure out if you actually need them separated or not.
  12. Don't you mean 2 columns, not 2 rows?
  13. Not really -- seems like a DBA nightmare -- are you actually manipulating each "piece" individually?
  14. Why not?
  15. Sorry, I don't follow -- you have dynamic table names? how is the related to the previous query's output?
  16. Ignore my previous response -- I wasn't thinking straight. See the answer I just posted here - http://www.phpfreaks.com/forums/index.php?topic=343277.0. So: SELECT a.date, a.id, a.category FROM staff_acccat a LEFT JOIN staff_acccat b ON ( a.date < b.date AND a.id = b.id ) WHERE b.date IS NULL Find all records for where there is no "more recent" match (on ID), looking at date.
  17. SELECT a.file_id, a.score, a.submit_date FROM `file_grade_answers` AS a left JOIN `file_grade_answers` AS b ON ( ( a.file_id ) = ( b.file_id ) and a.submit_date < b.submit_date ) where b.submit_date is null; Sorry, it's been that kind of day -- basically, you're asking for all answers for which there is no more recent answer, for a given file_id.
  18. That's a single record -- I'll need many.
  19. Oops -- missing the "a.filegrade_id = b.filegrade_id" equality.
  20. Please post the relevant insert statements so that I can test it on my end -- that was supposed to work.
  21. Tables containing tuples with those assignments.
  22. SELECT a.`score` FROM `file_grade_answers` AS a INNER JOIN `file_grade_answers` AS b ON ( a.file_id = b.file_id and a.submit_date > b.submit_date )
  23. I'd recommend a self join on submit_date.
  24. Your example is too generic - I don't understand anything from "table1" and "col1".
  25. You'll need to wrap then in yet another select.
×
×
  • 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.