Level 102
Sounds like you want to count by case? https://twitter.com/tray2_se/status/1614261959452659713?t=ayzR4G0lS_EQaUM_neqZeQ&s=19
2 likes
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
If I have the following example table:
id | username | col_A | col_B | col_C
and the following example query:
Table::select(...)
->where(function($query) {
$query->where('col_A', 'some_value')
->where('col_B', 'some_value');
->where('col_C', 'some_value');
})
->orWhere(function($query) {
$query->where('col_A', 'some_other_value')
->where('col_B', 'some_other_value');
})
->orWhere(function($query) {
$query->where('col_A', 'and_another_value');
});
Is it possible to count how many rows are resulted from each of the orWhere blocks?
Ty
Please or to participate in this conversation.