IN为空时如何让mysql中不显示行

How to make no rows display in mysql when the IN is empty

我使用以下查询从数据库中获取数据,当 IN () 不为空时它工作正常,但是当我的 IN 为空时我如何限制它显示无行

SELECT `id`, `date`, `user`, `type`, `module`, `action`, `ip_address`, `log` 
FROM `task_logs` 
WHERE `type`='E' AND ((`task` IN () AND (`module` = 'task' OR `module` = 'plan')) OR (`task` IN (35) AND `module` = 'regular_task')) 
ORDER BY `id` DESC

在 Postgres 中工作:

select *
from <table>
where id in (null)

编辑:但是你必须注意 id 永远不会 null 虽然 :-)