在 Solr 中找到查询方式时,我遇到了问题。
我在Oracle中的查询有效吗?但是在Solr中,我的方式不一样。有人有最好的方法来查询分组条件下的计数字段吗?
我的Oracle查询:
SELECT min(sta_datetime) startTime,
max(sta_datetime) endTime,
min(account) account,
COUNT(case when duration<=0 then 1 else NULL end) time1,
COUNT(case when duration>10 then 1 else NULL end) time2,
COUNT(case when duration <=10 and duration>0 then 1 else NULL end) time2
FROM account_sub
WHERE sta_datetime >= TO_DATE ('20180501000000', 'yyyymmddhh24miss')
AND sta_datetime < TO_DATE ('20180801000000', 'yyyymmddhh24miss')
AND subscriber = '1251251236'
And account in('account01','account02')
GROUP by account