How do I return my records grouped by NULL and NOT NULL?

前端 未结 14 1197
说谎
说谎 2021-01-30 16:24

I have a table that has a processed_timestamp column -- if a record has been processed then that field contains the datetime it was processed, otherwise it is null.

14条回答
  •  忘了有多久
    2021-01-30 16:46

    Another way in T-sql (sql-server)

    select  count(case when t.timestamps is null 
                        then 1 
                        else null end) NULLROWS,
            count(case when t.timestamps is not null 
                        then 1 
                        else null end) NOTNULLROWS
    from myTable t 
    

提交回复
热议问题