MYSQL 其中至少一列不为空
MYSQL where not null for at least one column
有一个交叉连接 table 需要为特定列捕获具有至少一个 not null
值的行:
where books.id is not null
or typings.id is not null
or translates.id is not null
是否有任何功能或方法可以防止在那个 where 子句中重复 not null
?
像这样:
where at_Least_not_Null_One_Of(books.id,typigns.id,translates.id)
使用COALESCE
:
COALESCE(books.id,typigns.id,translates.id) IS NOT NULL
有一个交叉连接 table 需要为特定列捕获具有至少一个 not null
值的行:
where books.id is not null
or typings.id is not null
or translates.id is not null
是否有任何功能或方法可以防止在那个 where 子句中重复 not null
?
像这样:
where at_Least_not_Null_One_Of(books.id,typigns.id,translates.id)
使用COALESCE
:
COALESCE(books.id,typigns.id,translates.id) IS NOT NULL