I will try to be as complete as possible here. This is the query that I'm trying to run:
SELECT usr_id, usr_username, usr_first_name, usr_last_name, usr_show_real_name, usr_photo_file, usr_thumbnail_width, usr_thumbnail_height, art_id, art_title, art_description, typ_id, SUM(arp_visits) AS visits, COUNT(fed_id) AS comments FROM users, articles, article_pages, types LEFT JOIN feedback ON fed_typ_target_id=art_id AND fed_typ_id=typ_id WHERE usr_id=art_usr_id AND usr_status='active' AND art_status='approved' AND art_id=arp_art_id AND typ_name='articles' GROUP BY art_id ORDER BY art_created_date DESC LIMIT 0, 10 Anyway, it all comes down to the following: I'm trying to select the total number of comments and visits for a specific 'article', as symbolized as art_id. I currently only have 1 article in the 'articles' table, and 3 comments related to it on the 'feedback' table. This 'article' have 49 visits currently. The problem is that the number of visits that I receive from this query is actually the result of the multiplication of (comments * visits), which is 147. I searched the mailing lists extensively for the solution to this problem, but nothing was there. I mean, there are a lot of similar emails but I couldn't find the solution yet, so I figured it would make sense to try on the list itself. Any help would be appreciated. Here is the stats of my system: [jpm@mercury: Tue Nov 20 10:39:54] [~]$ mysql -V mysql Ver 11.15 Distrib 3.23.40, for pc-solaris2.8 (i386) Cheers, Joao -- Joćo Prado Maia <[EMAIL PROTECTED]> http://phpbrasil.com - php com um jeitinho brasileiro -- Precisando de consultoria em desenvolvimento para a Internet ? Impleo.net - http://impleo.net/?lang=br --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php