arctushar
6 months ago

orwhereNotNull

Posted 6 months ago by arctushar

|codelist_id|q1|q2|q3|q4|year|

|224|NULL|NULL|NULL|NULL|2019|

|224|NULL|NULL|10|NULL|2018|

|224|NULL|NULL|13.67|NULL|2017|

|224|NULL|NULL|NULL|NULL|2016|

I have some data like above in a table. I want to make query as above

  1. if any one value of q1 or q2 or q3 or q4 in 2019 is found not null, then pick 2019 other wise search for next year 2018, then so on 2017, 2016

For example as there is not value in any of q1,q2,q3,q4 in 2019 then it will get data of 2018 as there is q3 value. if there was no value in q3 of 2018, then picked 2017.

is it possible ??????

Please sign in or create an account to participate in this conversation.