0

I have used the following query to get the data from database its working fine when the IN () is not empty but how can i restrict it as displaying no rows When my IN is empty

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
shA.t
  • 16,580
  • 5
  • 54
  • 111
Raja Manickam
  • 1,743
  • 4
  • 20
  • 28

1 Answers1

1

Working in Postgres:

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

Edit: But you have to take care that id is never null though :-)

Smutje
  • 17,733
  • 4
  • 24
  • 41