MYSQL,其中至少一列不为null
作者:互联网
交叉联接表需要捕获特定列至少具有一个非空值的行:
where books.id is not null
or typings.id is not null
or translates.id is not null
是否有任何函数或方法来防止在where子句中重复不为null?
像这样的东西:
其中at_Least_not_Null_One_Of(books.id,typigns.id,translates.id)
解决方法:
使用COALESCE
:
COALESCE(books.id,typigns.id,translates.id) IS NOT NULL
标签:where-clause,notnull,mysql 来源: https://codeday.me/bug/20191026/1940153.html