select TOP 10
(SELECT Count(*)
from tblPictureComment pc
WHERE pc.PictureCommentPictureId = p.PictureId) as cc,
p.*
from tblPicture as p
order by 1 desc
Frågan#1
[kod]
select TOP 10 CountComment, *, (SELECT Count(*) As CountComment from tblPictureComment WHERE tblPictureComment.PictureCommentPictureId = tblPicture.PictureId) from tblPicture
[kod]
vad kan vara fel??
har alltså en tabell med massa "bilder" och en tabell med kommentarer till dessa bilder, med då en koppling via ett ID
vill nu alltså få fram de tio bilder som har flest kommentarer
har jag rört till det?