Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8357

Re: Problem with Case when null

$
0
0

Hi Please find the logic below:

 

 

SELECT "0PLANT", "0MATERIAL",
  (case when sum(case when "0MOVETYPE" = 602 then 1 else 0 end) > 0
  then max(case when "0MOVETYPE" = 602 then "0PSTNG_DATE" end)
  when sum(case when "0MOVETYPE" = 601 then 1 else 0 end) > 0
  then max(case when "0MOVETYPE" = 601 then "0PSTNG_DATE" end)
  when sum(case when "0MOVETYPE" = 102 then 1 else 0 end) > 0
  then max(case when "0MOVETYPE" = 102 then "0PSTNG_DATE" end)
  when sum(case when "0MOVETYPE" = 101 then 1 else 0 end) > 0
  then max(case when "0MOVETYPE" = 101 then "0PSTNG_DATE" end)
  end) as Last_Sales_Date
\FROM "NM1"."PUBLIC"."IZDSO_DMR" Table__1
Group By "0MATERIAL", "0PLANT"

 

Thanks,

G Sampath Kumar


Viewing all articles
Browse latest Browse all 8357

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>