finalStringsql="select acc.ts, acc.period, count(acc.value) as value, acc.srv_id from (select date_trunc(:delta, timestamp) AS ts, :delta as period, count(account_id) as value, srv_id, account_id from user_connections "+
finalStringsql="select acc.ts, acc.period, count(acc.value) as value, acc.srv_id from (select date_trunc(:delta, timestamp) AS ts, :delta as period, count(account_id) as value, srv_id, account_id from user_connections "+
" where timestamp between :begindate and :enddate "+
" where timestamp between :begindate and :enddate "+
" and (:account_ids_empty = true or account_id in (:account_ids))"+
" and (:account_ids_empty = true or account_id in (:account_ids))"+