假设我有上面的结果,并且想要排除 ID 为 14010497 的所有行,因为至少其中一行的日期为 2/25。我将如何过滤它?使用 WHERE table.end_date > '2019-02-25'
仍会包含日期为 2-23 的行
最佳答案
尝试这样的事情:
select * from your_table
where id not in (
select distinct id
from your_table
where end_date > '2019-02-25'
)
/
关于sql - 如何根据psql中一条记录的值排除具有相同ID的所有行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55462487/