items table(the users will select and store into mysql
itemID | name | item
1 | Mary | pants, jeans
2 | John | jacket, shirt
3 | Jack | jacket, shirt
description table
descID | item
1 | jacket, shirt
2 | pants, jeans
3 | dress, jeans
comment table (retrieve the no of comments made)
commentId| item | comment
1 | jacket | great
2 | jacket | nice
3 | jeans | comfortable
如何从评论表示例中检索评论数,约翰登录。它应该检索 2。
到目前为止,我有这个 SQL 语句:
SELECT DISTINCT(COUNT(comment)) AS comment
FROM comment co
INNER JOIN item i
WHERE co.item = i.item;