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
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:
Post a Comment