Y
Yahweh
Guest
I know SQL well enough, but I cant seem to get my query to work. Basically, I am trying to display a series of posts, with the number of comments on the side.
I have two tables, Entries and Comments, which look like this:
Comments.PostID corresponds to Entries.ID on a many-to-one relationship.
I want to run a query that will join the number of comments (which is a Count of each row in the Comments table where Comments.PostID = Entries.ID) to the existing table, so that it will look like this:
Usually, this would be a really simple SQL statement, but as I am using a Memo field, I am getting a "cannot use Memo field in aggregate function" error.
I'm not sure what to do, any help would be appreciated
I have two tables, Entries and Comments, which look like this:
Code:
Entries
---------
ID Title Content (memo field)
1 Cats Something about cats here
2 Dogs Something else about dogs here
3 Rodents My pet rat runs in a wheel
etc.
Comments
--------
ID PostID Comments
1 1 My cat's name is mittens
2 1 I taught my cat how to throw a curve ball
3 3 Rats like squeak toys
4 2 Nobody likes dogs
5 3 Bunnies make good pets
6 1 Cats are witches in disguise
I want to run a query that will join the number of comments (which is a Count of each row in the Comments table where Comments.PostID = Entries.ID) to the existing table, so that it will look like this:
Code:
Entries (with #ofcomments joined)
----------
ID Title Content (memo field) #ofcomments
1 Cats Something about cats here 3
2 Dogs Something else about dogs here 1
3 Rodents My pet rat runs in a wheel 2
etc.
Usually, this would be a really simple SQL statement, but as I am using a Memo field, I am getting a "cannot use Memo field in aggregate function" error.
I'm not sure what to do, any help would be appreciated

Last edited: