Warning I'm new to anything other than basic SQL so this 'might' seem like a
daft question.
My problem is - I've have two tables one hold's photo details and is called
'PhotoTable' it is linked via it's key field 'PhotoID' to another table
'CommentsTable' that can hold multiple comments for each photo in the photo
table. For each comment in the comment table there is a flag field
'CommentVerified' that is changed to a '2' once that particular comment has
been assessed/verified.
What I would like is a SELECT statement that will pull all fields from the
photo table along with a count of the number of verified comments for that
particular photo (the actual photo records pulled should come from arguments
based on the photo table). So far the best I have is this -
SELECT * FROM PhotoTable , CommentsTable
WHERE PhotoTable.PhotoID = CommentsTable.PhotoID
But this has problems, The WHERE statement I want would be more like -
WHERE PhotoTable.PhotoCat = 'VariableValue' the one I have only pulls
records of photos that have at least one comment (I understand why, just not
how to change it)
Also instead of it just supplying the values of the comments verified fields
I would like a count of the number of relevant comments for each photo (only
those which are containing a '2')
OK I hope this makes some sense to someone out there.
Cheers
DyslexicFingars