I have a SQL Server 2008 R2 database. This database has two tables called Pictures and PictureUse.
Picture table has the following columns:
Id (int)
This will work
SELECT P.id ,P.PictureName ,COUNT(P.id) as [Count] FROM Picture P INNER JOIN PictureUse PU ON P.id=PU.Pictureid GROUP BY P.id,P.PictureName