I have a postgresql table called login_logs which has the following fields:
date, time, username, ip_addr
I have the following SQL that gets logins greater than or equal to a certain date:
SELECT * FROM login_logs WHERE date>='2016-10-01'
However, I want to only get list of usernames and dates WHERE a username has more than one login on the same day. So for example if a username has an entry twice or more then it should return that username, the date with the count of how many logins for that day. So if the user has another date with more than two logins too that should also show up with the username, date and the count.
Any ideas how I can do this?
dateis a bad name for a column. So istime. BTW: it is more convenient to combine date+time into a timestamp, and use that.