I have two partitions from an SQL table containing num_key records. I need to compare and count changes in the February records versus the January records.
SAMPLE DATA AND DESIRED RESULTS:
ptn_dt = '2019-01-31' (January)
| num_key | active_indicator | 
|---|---|
| 111 | true | 
| 112 | false | 
| 113 | false | 
| 114 | false | 
| 115 | true | 
| 116 | true | 
ptn_dt = '2019-02-28' (February)
| num_key | active_indicator | 
|---|---|
| 111 | true | 
| 112 | false | 
| 113 | true | 
| 114 | true | 
| 115 | true | 
| 116 | true | 
| 117 | true | 
| 118 | false | 
| 119 | true | 
EXPECTED OUTPUT:
What SQL query could I use? I need to get the count of all active_indicator=true in the February partition but divided into 3 outputs (new entries, false to true from Jan to Feb, and true to true from Jan to Feb).