I am trying to count the number of messages userid = 1 did and then COUNT the number of messages of all the other userid and print out the names of the people where the number of messages = the number of messages userid = 1 has.
因此,我需要做一个nes计。 我有2个表格。 信息和用户。
例如:
SELECT COUNT(*)
FROM MESSAGES
WHERE user_id = 1
And the result is 2. Then I need
SELECT COUNT(*)
FROM MESSAGES
WHERE COUNT(*) = 2
我如何为此nes计,以便我能够做这样的事情。
SELECT USER.user_name
FROM MESSAGES INNER JOIN USER ON MESSAGES.user_id = USER.user_id
WHERE COUNT(*) = (
SELECT COUNT(*)
FROM MESSAGES
WHERE user_id = 1
)
以上例子对我不利。 我正在使用Access女士。 任何帮助都将受到赞赏。 谢谢。