Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/mn_kw/article/details/90670671
count(distinct case trainnumber when 'null' then 0 when '0' then 0 else trainnumber end) as train_num