Hari Shanker

Hari Shanker

  • NA
  • 260
  • 34.2k

sql server counts of columns

Dec 20 2016 2:22 AM
 Hi,
 
 
select count(*) from table1 where inventoryid = 21 -- 132
select count([expired]) from table1 where inventoryid = 21 and [expired] = 1 -- 57
select count([Consigmment]) from table1 where inventoryid = 21 and [expired] = 1 -- 54

· I need the results as in below screenshot - with a single query

 
InventoryId   Counts Expired Consigmnet
21 132 57 54
       
 
 
Regards,
hari 

Answers (1)