How I can migrate clickhouse countIf function to linq2db?
Example:
from =>
SELECT customer_id,
countIf(customer_id, active_month between 0 and 1) as active_month1
FROM myt_table
GROUP BY customer_id
to =>
from x in my_table
group x by x.customerId into g
select new {
CustomerId = g.Key,
ActiveMonth1 = Sql.CountIf(x, p => p.customerId, p => p.ActiveMonth.between(1, 6))
}
I tried this option but it has problems
from x in MyTable
group x by x.CustomerId into g
select new {
CustomerId = g.Key,
FirstMonthCount = g.Count(p => 1 >= p.ActiveMonth && p.ActiveMonth <= 6)
}