How to get user count & user session count using usql

Hi,

I am trying to gather user count & user session count using usql,but the metrics it was giving is not matching.

Can someone help me with the proper query to get these metrics.

Thanks,

For the user session count you can use:

SELECT Count(*) FROM usersession

For user count use the following for tagged users:

SELECT Count(DISTINCT(userid)) FROM usersession

or this one if you want all users, including anonymous users:

SELECT Count(DISTINCT(internalUserId)) FROM usersession