Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个包含数千个条目的数据库
“id”是主键
“事件描述”
“事件时间”
“地点”
在一个 php 脚本中,我需要从表中选择所有行,如果“locationXXX”出现在多行中,则收集与相应“event_time”配对的“event_description”的各种值,并将它们作为列表项回显
如果相反,没有重复项,则正常选择它并回显结果
改变表结构是一种选择,但我宁愿不
非常感谢任何帮助
假设表被调用event
event
SELECT location, event_description, event_time FROM event GROUP BY location HAVING COUNT(location) > 1;