Popular Posts

SQLblog.com - The SQL Server blog spot on the web

Wednesday, October 4, 2017

select count of rows based on condition

SQLServerCentral » Latest topics
select count of rows based on condition
Hi,

Need to select count of rows based on codition from a table.

Tried with this query , but no luck.

select
CASE WHEN TYPE ='D' THEN count(TYPE) end AS 'TotalXRows',
CASE WHEN TYPE ='L' THEN count(TYPE) end AS 'TotalYR

No comments: