简体   繁体   English

选择具有特定列的值为空或“默认”的行

[英]Selecting rows with specific columns having a null or 'default' value

I've got a rather large DB and I need to select the fields where they are null or defaulted. 我有一个相当大的数据库,我需要选择为空或默认的字段。

For example: 例如:

Table: Table_A
Row #1234
    name,  mname, lname
    [data] [data] [null]

I'd need a query to generalize this, so that I can select "lname", where it is NULL, or mname, or none based on its state. 我需要一个查询来对此进行概括,以便我可以选择“ lname”,其中它为NULL或mname,或者根据其状态都不选择。

-- -

I just need to SELECT all "NULL" or "FALSE" fields in a row, and return only those fields which are NULL or FALSE. 我只需要连续选择所有“ NULL”或“ FALSE”字段,然后仅返回那些为NULL或FALSE的字段。

尝试

SELECT * FROM table WHERE col1 IS NULL or col2 IS NULL or ... or col1 = 'default' or col2 = 'default' ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM