【发布时间】:2016-09-28 13:56:59
【问题描述】:
我有以下疑问:
select distinct * from my_table where %s is NULL;
我希望能够向此查询传递多个列名,但我不知道每次要检查多少列是否为空。
如何使用上述查询参数技术从同一语句中进行以下查询?:
select distinct * from my_table where "col1" is NULL or "col2" is NULL;
select distinct * from my_table where "col1" is NULL or "col2" is NULL or "col3" is NULL;
我将不胜感激包括能够获得以下内容的答案,但在这种情况下没有必要:
select distinct * from my_table where "col1" is NULL;
(我正在使用 Amazon Redshift,以防消除与 postgresql 相关的可能性)
【问题讨论】:
标签: python postgresql amazon-redshift psycopg2