1

以下 SQL 代码返回时选择的所有内容均为 NULL,event_size 为 0。我的表已根据以下条件正确设置。我在这里做错了什么?谢谢您的帮助

SELECT table_one.event_id AS event_id, table_one.event_name AS event_name, table_one.event_address AS event_address, COUNT( table_two.user_id ) AS event_size
FROM table_one
JOIN table_two
ON table_one.event_id = table_two.event_id 
WHERE (
       table_one.event_start_date =  '5/10/2012'
    OR table_one.event_mid_date =  '5/10/2012'
    OR table_one.event_end_date =  '5/10/2012'
)
ORDER BY event_size DESC 
4

1 回答 1

0

尝试添加一个 group by 子句:

group by table_one.event_id, table_one.event_name, table_one.event_address

这应该做你想要的。

于 2012-05-10T20:59:40.757 回答