Sql case when is null then 0


















I hope this is a helpful alternative. Jason caught an error, so this works Can anyone confirm the other platform versions? The problem is that null is not considered equal to itself, hence the clause never matches. Add a comment. Active Oldest Votes. Joachim Isaksson Joachim Isaksson k 22 22 gold badges silver badges bronze badges. Thanks, I'll try this tomorrow. I only fixed the syntax of your query, I can't quite see the logic in your desired result without seeing some input data.

Does that help a little? I'm fairly new to SQL so it will take me a while to build you the schemas on that site. Show 5 more comments. Gordon Linoff Gordon Linoff 1. This runs but doesn't return a value for DATE, it just gives everything a null. Xin Xin Mahesh Sambu Mahesh Sambu 2 2 silver badges 13 13 bronze badges. Abdullah Zaid Abdullah Zaid 1 1 silver badge 9 9 bronze badges.

Kees de Wit Kees de Wit 1, 14 14 silver badges 26 26 bronze badges. Slight variation on Mahesh solution for mssql: case when isnull B. Amirhossein 2 2 gold badges 10 10 silver badges 31 31 bronze badges. Your welcome, please read help center and get tour for give best feedback. I tried that already and just retried again and still receiving NULL results Problem was that was actually string NULL.

Add a comment. P , isnull R. P , case when R. P end as replacingNulls from RBase r. Kritner Kritner 13k 10 10 gold badges 45 45 silver badges 68 68 bronze badges.

Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Making Agile work for data science.



0コメント

  • 1000 / 1000