S
SpookiePower
I have two tables TUser and TSignInLog.
In TUser I have these fields -
iUserID
Firstname
Lastname
In SignInLog I have this field -
iUserID
I now want to count how many times, each user have logged in,
and show it with the users names.
I can do it without there names like this -
SELECT iUserId, count(iUserId) AS Logins
FROM TSignInLog
GROUP BY iUserId
order by iUserId desc;
But with there names, I can't figure it out.
My guess is this, but it wont work -
SELECT Firstname, Lastname, count(iUserId) AS Logins
FROM TUser INNER JOIN TSignInLog on TSignInLog.iUserId=TUser.iUserid
GROUP BY iUserId
order by Logins desc;
In TUser I have these fields -
iUserID
Firstname
Lastname
In SignInLog I have this field -
iUserID
I now want to count how many times, each user have logged in,
and show it with the users names.
I can do it without there names like this -
SELECT iUserId, count(iUserId) AS Logins
FROM TSignInLog
GROUP BY iUserId
order by iUserId desc;
But with there names, I can't figure it out.
My guess is this, but it wont work -
SELECT Firstname, Lastname, count(iUserId) AS Logins
FROM TUser INNER JOIN TSignInLog on TSignInLog.iUserId=TUser.iUserid
GROUP BY iUserId
order by Logins desc;