【发布时间】:2021-02-11 10:26:22
【问题描述】:
我需要有两列或多列满足相同条件的行。 像这样的:
id | column1 | column2 | column3
--------------------------------
1 | 'yes' | 'yes' | 'yes'
2 | 'yes' | 'yes' | 'no'
3 | 'yes' | 'no' | 'no'
4 | 'no' | 'no' | 'no'
5 | 'yes' | 'no' | 'yes'
6 | 'no' | 'yes' | 'yes'
所以,我需要执行一个返回 id 为 1,2,5,6 的行的 SELECT 子句 逐一进行 AND/OR 组合会产生一个非常大的子句(实际上有 8 列)。 还有其他更快的方法吗?
谢谢
【问题讨论】:
标签: sql postgresql count combinations where-clause