← count operator page · aggregate/count/count_in_having/manual_ex_2
pandas ✅ · DuckDB ✅
count ( ) without operand in a having condition.
Counting the number of data points, Example 2, output verbatim; the Aggregate invocation: "The count operator is used in a havingCondition without parameters".
2011 has 3 data points and is kept, 2012 has 2 and is dropped: int_var = 3 for 2011. With one measure and no null, #1049 gives the same output.
DS_r := count ( DS_1 group by Id_1 having count() > 2 );
| Id_1 | Id_2 | Id_3 | Me_1 |
|---|---|---|---|
| 2011 | A | XX | iii |
| 2011 | A | YY | jjj |
| 2011 | B | YY | iii |
| 2012 | A | XX | kkk |
| 2012 | B | YY | iii |
{
"datasets": [
{
"name": "DS_1",
"DataStructure": [
{"name": "Id_1", "type": "Time_Period", "role": "Identifier", "nullable": false},
{"name": "Id_2", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Id_3", "type": "String", "role": "Identifier", "nullable": false},
{"name": "Me_1", "type": "String", "role": "Measure", "nullable": true}
]
}
]
}
| Id_1 | int_var |
|---|---|
| 2011 | 3 |
{
"datasets": [
{
"name": "DS_r",
"DataStructure": [
{"name": "Id_1", "type": "Time_Period", "role": "Identifier"},
{"name": "int_var", "type": "Integer", "role": "Measure"}
]
}
]
}