nileshbgp123 (11/18/2015)
Thanks a lot for your reply, as i said earlier i am not so good in SQL, Can you please just explain me how the value of SUPPLY is given i need the explanation to it. I am basically from AS400 part and use basic select or create statements. Here in the above view creation there are multiple When condition with few coalesce statements which i am not at all aware of. Can you please help.Regards
Nilesh
I don't have the time to decompose it fully, sorry.
But I will give you some relevant info.
The CASE construction works as follows:
case when condition1 then value when condition2 then value2 else value3 end
Conditions are evaluated from left to right. There can be any number of them.
COALESCE works as follows:
COALESCE(val1, val2, ..., valn) returns the first non-NULL item in the list of arguments.
COALESCE(val, 0) is an ugly way of returning zero when the value is NULL (better to use IsNull(val,0)).
Based on this, I suggest you break the statement into chunks.
If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.