I have a sql table with following values

```
       |  col1 | col2|   source |  values
       |  1    |  2  |  A       |   null
       |  1    |  2  |  B       |   1.0
       |  1    |  2  |  C       |   null
       |  1    |  4  |  A       |   2.0
       |  1    |  4  |  B       |   2.0
       |  1    |  4  |  C       |   2.0
       |  1    |  5  |  A       |   null
       |  1    |  5  |  B       |   null
       |  1    |  5  |  C       |   null

```

How can I get an output with a group by of `col1` and `col2` with a flag:

* all values match for a group ( flag = 1)
* all values are null ( flag = 2)
* some values is null (flag = 3)

Output:

```
       |  col1 | col2|   flag
       |  1    |  2  |   3
       |  1    |  4  |   1
       |  1    |  5  |   2

```