Hi

Having a bit of bother with this one, wondering if anyone has the answer,

I've got two tables one is News items

News_ID    News    etc...
1                Today in .....etc
2                Hello world .....etc
3                Blar di blar....etc
4                And now time for something else
.
.
100            The last thing

and the other is comments on the news items (as well as other things on the
web site)

Type        Comment_ID        Comment  etc...
News        1                        What about today then...
News        1                        This is still today...........
News        4                        This parot is dead......
NotNews   4                        Hello..............

What I am trying to get is one SELECT statment that will give me

News_ID        News               Comment_Count  etc...
1                   Today in ...       2
2                   Hello world.       0
3                   Blar di blar        0
4                   And now ...etc  1


I've tried quite a few SELECTs using LEFT JOIN and HAVING and the best I can
do is a news list showing only Items that have Comments so the above would
have returned only NEWS_ID 1 and 4 but not giving 2 and 3 were I want
1,2,3,4.....100.

Please help, sorry if this is kids stuff but I'm only just starting with
MySQL.

Cheers Karl.


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