using sql count in a case statement

前端 未结 8 1491
花落未央
花落未央 2020-12-13 17:29

I have a table and i need to present the output in the following fashion.

tb_a:

col1  |  reg_id | rsp_ind 

Count of rows with rsp_ind = 0

8条回答
  •  半阙折子戏
    2020-12-13 18:10

    Close... try:

    select 
       Sum(case when rsp_ind = 0 then 1 Else 0 End) as 'New',
       Sum(case when rsp_ind = 1 then 1 else 0 end) as 'Accepted'
    from tb_a
    

提交回复
热议问题