我正在尝试做这个咨询,我有以下错误:“Mysql2 ::错误:操作数应该包含1列”
SELECT
COUNT(ev.id) as event_counter,
events.*
FROM
`events` INNER JOIN `events_organizations` ON `events`.`id` = `events_organizations`.`event_id`
LEFT OUTER JOIN events ev ON ev.model_id = events.id
WHERE
`events_organizations`.`organization_id` = 1
AND (events.kind = 1
AND events_organizations.event_administrator = true)
AND (events.situation = 1)
AND (events.event_type_id = '3','5','2','1','4')
GROUP BY
events.id
ORDER BY
event_counter DESC, name
答案 0 :(得分:1)
纠正这个:
AND (events.event_type_id = '3','5','2','1','4')
到此:
AND (events.event_type_id IN ('3','5','2','1','4'))
答案 1 :(得分:0)
FROM events INNER JOIN `events_organizations`...LEFT OUTER JOIN events
看到问题?同桌两次。移除此行
LEFT OUTER JOIN events ev ON ev.model_id = events.id
如果您想要所有活动,请将INNER更改为LEFT JOIN。