我有两个表:event_to_state_groups
和events
我可以通过
选择要在event_to_state_groups
中删除的所有条目
SELECT events.event_id, room_id, sender
FROM event_to_state_groups, events
WHERE event_to_state_groups.event_id = events.event_id
AND events.room_id like '%jGUBNvBzjGyQyKKMJV:matrix.org'
如何从event_to_state_groups
表中删除所有与%jGUBNvBzjGyQyKKMJV%
表中的room_id events
连接的条目?
答案 0 :(得分:0)
检查
delete FROM events using event_to_state_groups
WHERE event_id=event_to_state_groups.event_id AND room_id like '%jGUBNvBzjGyQyKKMJV%'
答案 1 :(得分:0)
尝试一下:
delete from event_to_state_groups where room_id
IN (select e.room_id from event_to_state_groups e
INNER JOIN events ev on e.event_id = ev.event_id
WHERE e.room_id ilike '%jGUBNvBzjGyQyKKMJV%')