SQL query for getting count on same table using left outer join
Posted
by
Sasi
on Stack Overflow
See other posts from Stack Overflow
or by Sasi
Published on 2011-01-16T23:07:27Z
Indexed on
2011/01/16
23:53 UTC
Read the original article
Hit count: 287
Hi all,
I have a table from which i need to get the count grouped on two columns.
the table has two columns one datetime column and another one is success value(-1,1,0) What i am looking for is something like this...
count of success value for each month
month----success-----count
11------- -1 ------- 50
11------- 1 --------- 50
11------- 0 ------- 50
12------- -1 ------- 50
12------- 1 ------- 50
12------- 0 ------- 50
if there is no success value for a month then the count should be null or zero. I have tried with left outer join as well but of no use it gives the count incorrectly.
Thanks in advance Sasi
© Stack Overflow or respective owner