I'm not a DB expert but i'm trying to get time wise user online count to show in a graph. I have manage to get online user count for current time but how to get for a time span ? i need each minute online user count.

here is my query so far

select count(*) from connectivity_log cl inner join (
select cl2.socket_client_id,max(cl2.date_time) as MaxDate from 
connectivity_log cl2 group by cl2.socket_client_id 
) cl3 on cl.socket_client_id = cl3.socket_client_id and 
cl3.MaxDate=cl.date_time and cl.connected=true

Here is my table structure

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.