I am trying to run a SQL query on a result table like this:
  name   |  property   |   col1   |   col2  
___________________________________________ 
 abc     |  temp.a     |   1      |   0
 abc     |  temp.b     |   1      |   0
 abc     |  perm.a     |   1      |   1
 abc     |  date       |   0      |   0
 abc     |  perm.b     |   1      |   0
I want to group all the similar rows and count the col1 and col2 as just 1 instead of taking a sum, which should look something like this:
name   |   propertyname   |   count_col1   |  count_col2
___________________________________________________________
abc    |   temp.%         |   1            |  0
abc    |   perm.%         |   1            |  1
abc    |   date           |   0            |  0
I tried some sql queries but it doesn't work. I tried using common table expressions ( like 'with' keyword) also but is there a better way of writing the SQL?
 
     
     
    