Jump to content

fenway

Staff Alumni
  • Posts

    16,168
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by fenway

  1. LIMIT 1 might help too.
  2. That's two separate things -- find out which cats match, and then getting a random one for each.
  3. This seems very much like a continuation of this thread....
  4. Actually, you have to use "*" first. And I prefer CONCAT_WS().
  5. See here for starters.
  6. Why the union? And the syntax is a bit funny... cut-and-paste error?
  7. That's not proper syntax. SELECT items.Title, items.Description FROM items INNER JOIN author USING (Author_id ) INNER JOIN cost USING ( Cost_id ) INNER JOIN type USING ( Type_id ) INNER JOIN rate USING ( Rate_id ) INNER JOIN func USING ( Func_id ) Though I don't see the need for the other tables at this point.
  8. 1) How do you mean? 2) if you have images1 and images2, then your table isn't normalized.
  9. You could try: INSERT INTO `paul_pages` SELECT '', 'page title', '<p>page content</p>', 0 , 0, MAX (`page_order`) + 1 FROM `paul_pages` Though I would recommend a column list.
  10. Explain that logic of that query, please... does it do what you expect/
  11. You're missing single quotes around your string literals in your query string.
  12. Why not just uninstall it?
  13. Many-to-many would mean that the same row in table1 can be related to multiple rows in table2, and vice versa. And the reason it's so "difficult" is because you've presented vague generalities without giving the real-world example. And you've left out fields too --- like the rating aspect -- so its hard to know what's in the tables. You may think it's not relevant, but that doesn't make it any eaiser for the rest of us to figure out what you already know. Based on what you've just recently posted, I understand the tables as follows: "table1" = rating - ( item_id, user_id, rating_value ) "table2" = item - ( item_id, user_id, ready ) I assume the user_id in the item table refers to the person who created the item, whereas the user_id in the rating table refers to the person actually rating the item. So this is a one-to-many relationship -- each item can have multiple ratings, but not vice-versa. If this is all true, then you need to be joining on item_id, NOT user_id. select count(r.item_id) from ratings as r inner join items as i using ( item_id ) where i.ready = 1 There should be no "multiplying" as you indicated above, since there is only one item record for each ratings record.
  14. Who set up cPanel -- ask them.
  15. fenway

    php error

    Look here.
  16. I was confused by the query above... so there's a many-to-many relationship here?
  17. Make sure you are using the appropriate character set/ colleation.
  18. Sure... let's take it from the top... what are you trying to display, and why do you have the group by?
  19. No problem.. don't know what I was thinking before; inner join before FROM? I need more sleep ;-)
  20. Then echo the query so we can see what it's actually doing.
  21. Of course you do... I didn't say anything about distinct.
  22. Sorry, my bad, multi-tasking: SELECT count(*), c2.yourScore FROM cache AS c1 CROSS JOIN (SELECT minutes_online_month AS yourScore FROM cache WHERE username = 'jaymc') as c2 WHERE c1.minutes_online_month > c2.yourScore
  23. Neither can we, since we don't see (a) the actual query sent to the server or (b) the actual error message returned from the server (from mysql_error()).
  24. Hmm. How about: SELECT count(*), yourScore INNER JOIN (SELECT minutes_online_month FROM cache WHERE username = 'jaymc') as yourScore FROM cache WHERE minutes_online_month > yourScore
×
×
  • 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.