finalStringsql="select date_trunc(:delta, timestamp) AS ts, :delta as period, sum(connect_duration) as value, srv_id from user_connections "+
finalStringsql="select date_trunc(:delta, timestamp) AS ts, :delta as period, sum(connect_duration) as value, srv_id from user_connections "+
"where (:account_ids_empty = true or account_id in (:account_ids)) and connect_duration != 0 and timestamp between :begindate and :enddate "+
"where (:account_ids_empty = true or account_id in (:account_ids)) and migration_id is null and connect_duration != 0 and timestamp between :begindate and :enddate "+
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 "+
" and (:account_ids_empty = true or account_id in (:account_ids))"+