Jump to content

fenway

Staff Alumni
  • Posts

    16,168
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by fenway

  1. What do you mean "and my first 20" -- there is no "my", there's only a single query. I'm very confused.
  2. That's confusing -- the only thing that could have changed was the count -- was it correct before?
  3. fenway

    COUNT query

    So you don't care which machine it's own?
  4. Forget about the PHP -- does the mysql query not return 10 results?
  5. Sure -- the idea is that you want no more than 10 from each table, and then when you have a max of 20 records, re-sort and limit again. ( SELECT os_comments.comment_author AS author, os_posts.post_title AS title,os_posts.guid AS guid, os_comments.comment_date AS date FROM os_comments, os_posts WHERE os_comments.comment_post_ID = os_posts.ID AND os_posts.post_status = 'publish' AND os_comments.comment_approved = 1 ORDER BY os_comments.comment_date DESC LIMIT 10 ) UNION ALL ( SELECT dna_comments.comment_author AS author, dna_posts.post_title AS title,dna_posts.guid AS guid, dna_comments.comment_date AS date FROM dna_comments, dna_posts WHERE dna_comments.comment_post_ID = dna_posts.ID AND dna_posts.post_status = 'publish' AND dna_comments.comment_approved = 1 ORDER BY dna_comments.comment_date DESC LIMIT 10 ) ORDER BY comment_date DESC LIMIT 10
  6. Oh -- then the query you had is fine, but you're missing the order by with the limit in the end.
  7. Don't double-post.
  8. Sorry, I don't follow.
  9. You want LIMIT 10 in each, and then LIMIT 10 on the outside.
  10. Too broad a question -- but if NOT IN is the only predicate in the WHERE clause, you're looking at a full table scan. Post the query, the EXPLAIN output, and we'll take it from there.
  11. Use "COUNT( DISTINCT cd.d ) AS e" instead.
  12. It looks like you're using these as flags -- if so, they should be in another table, and that way, you can simply search for "where any attribute is set", and you don't have to get back field names.
  13. Don't know of any specifics, but searching this board can't hurt -- anyone else?
  14. fenway

    COUNT query

    Could you post sample output from the query, and the desired output as well?
  15. fenway

    Versioning

    Sorry, I don't follow.
  16. fenway

    Versioning

    No, I meant why the question mark in your code samples. But if it's just for a course, do the bare minimum, you don't need a real-world, live-data solution.
  17. There are hundreds of such examples -- but blindly uploading user data without sanitizing and validating it is going to be tricky.
  18. Any questions about colours and browsers belong on another board. Pagination is also heavy discussed on this board (many, many threads) as well as the PHP Help board as well.
  19. In general, USING isn't that helpful -- you can't combine it with ON().
  20. That's correct.
  21. fenway

    Versioning

    Why the ?
  22. Oh, sorry, I didn't see that -- then just wrap this in yet another sub-query.
  23. There was a link to a URL that discusses this technique.
  24. Include "count(b) as e" in your subquery.
  25. Then closure paths are probably the best approach -- though really, really unintuitive.
×
×
  • 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.