MYSQL 至少一列不为空

ale*_*lex 4 mysql where-clause notnull

有一个交叉连接表需要捕获not null特定列至少具有一个值的行:

where books.id is not null 
or typings.id is not null
or translates.id is not null
Run Code Online (Sandbox Code Playgroud)

是否有任何函数或方法可以防止not null该 where 子句中出现重复?

像这样的东西:
where at_Least_not_Null_One_Of(books.id,typigns.id,translates.id)

Bla*_*ank 6

使用COALESCE

COALESCE(books.id,typigns.id,translates.id) IS NOT NULL
Run Code Online (Sandbox Code Playgroud)