Hi!

I have query from several tables - from news table, picture table and
comments table. It diplays headline, news from news table, number of
comments for news from comments table and picture alignment (on the web)
from pictures table.
As it could be many comments and also many pictures for one news (also
none), I use left join. Here is my query:

SELECT news.NewsID, news.headline, news.story, news.stmp,
count(comment.NewsID) AS nrcomments, pics.align FROM uudised
 left JOIN comment ON comment.newsid=news.newsid
 left join picsdb.pics on news.stmp=pics.stmp
 GROUP BY news.newsid ORDER BY news.date DESC, news.newsid desc limit 10;

So far so good.
Nothing wierd happens with nrcomments as long there is one picture for news.
But if I have more than one picture for news, and some comments too,
nrcomments gets multipied with number of pictures. So if I have 3 pisc and 5
comments, it shows me 15 comments, 2 pics and 4 comments, and 8 shows up in
nrcomments.

What is wrong?
Please reply to my email, I'm not currently subscribed.
Thanks!


---------------------------------------------------------------------
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

Reply via email to