我有一个现有的存储过程,我添加了一些参数来过滤结果。但是当@id_account为空时,它返回空数据。我想跳过 AND 当 @id_account 为空时,我尝试 IF 条件,但它不起作用。有什么建议吗?谢谢:D
和
(
pd_account.id_account = @id_account
)
最佳答案
输入你真正想要的条件,即:
(pd_account.id_account = @id_account or @id_account is null)
关于mysql - 当变量为 NULL 时跳过 AND,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32659196/