I have two tables:
Players
Player_id
email_address
highest_level
Login
login_id
ip_address
player_id
login_date
login_time
I'm looking to count the number of distinct logins per player, but only for login date 2014-06-01
and only for player email addresses ending in .net
.
I know how to do these things individually, but I'm struggling to put it all together. I'm stuck between using JOIN
or IN
and how exactly to set it up. Any help would be appreciated.
You can try this,
SELECT p.Player_id,COUNT(*) FROM PLAYERS p
INNER JOIN LOGIN l ON p.Player_id = l.Player_id
WHERE l.login_date = '2014-06-01' AND l.email_address LIKE '%.net'
GROUP BY p.Player_id
Sorry, i forget group by.. now i added.