Staggan
Staggan

Reputation: 77

Get maximum daily concurrent users with MySQL

I am trying to get the maximum concurrent users per day for our application and having some issues.

In each record I have a timestamp, concurrents and a server_name

I have tried:

SELECT timestamp, MAX(concurrents) FROM log where server_name like '%XXXX%' ;

This gives me a timestamp and the maximum ever concurrent

I then tried this:

SELECT timestamp, MAX(concurrents) FROM gss_performance_log g where server_name like '%turk%' group by timestamp;

This gives me lots of timestamps and lots of concurrents, with multiple timestamps on the same day

How can I get the single max concurrent for each day ?

Any advice would be appreciated

Thanks

Upvotes: 0

Views: 78

Answers (1)

juergen d
juergen d

Reputation: 204854

Remove the time part from your timestamp with date()

SELECT date(timestamp), MAX(concurrents) 
FROM gss_performance_log g 
where server_name like '%turk%' 
group by date(timestamp);

Upvotes: 1

Related Questions