I have a table structure like this
|---------------------|----------|-----------|
| col_1 | col_2 | col_3 |
|---------------------|----------|-----------|
| 2018-01-15 17:56 | A | 3 |
|---------------------|----------|-----------|
| 2018-01-15 17:56 | A | 2 |
|---------------------|----------|-----------|
| 2018-10-23 23:43 | B | True |
|---------------------|----------|-----------|
| 2018-10-23 23:43 | B | False |
|---------------------|----------|-----------|
| 2018-10-23 23:43 | A | 3 |
|---------------------|----------|-----------|
| 2018-10-23 23:43 | B | True |
|---------------------|----------|-----------|
I would like to group by col_1, and take average of col_3 if col_2 is A and take frequent value of col_3 if col_2 is B. The desired result would be
|---------------------|----------|-----------|
| col_1 | A | B |
|---------------------|----------|-----------|
| 2018-01-15 17:56 | 2.5 | Null |
|---------------------|----------|-----------|
| 2018-10-23 23:43 | 3 | True |
|---------------------|----------|-----------|
Without the frequency function when col_2 is B, I know I can do something like this
select col_1,
avg(case when col_2='A' then col_3 end) as A
from my_table
group by col_1
How shall I add frequency function when col_2 is B?