Untitled
unknown
mysql
2 years ago
469 B
4
Indexable
select name, count(*) as cnt from ( select cfv.client_id, cfo.name from client_field_value as cfv left join client_field_value_client_field_option as cfvcfo on cfv.id=cfvcfo.client_field_value_id left join client_field_option as cfo on cfvcfo.client_field_option_id=cfo.id where cfv.field_id=16 and cfv.client_id in ( select id from client where created_at between '2020-01-01' and '2021-01-01' ) ) as reasons group by name order by cnt desc
Editor is loading...