Monday, 14 March 2016

How to use case in where clause ?



select a.col1
      ,a.col2
      ,b.col1
      ,b.col2
from A a
    ,B b
where a.bookid=b.bookid
   and 1=
   (
   case
      when a.secid=0 and a.prodid=b.prodid then 1
      when a.secid=b.secid then 1
      else
         0
   end
   );

No comments:

Post a Comment

Query to find request set and its responsibility

  SELECT FA.application_name,        fr.responsibility_name program_attached_to,        frg.request_group_name,        fcp.request_set_name,...