How to get value of last attribute in a GROUP BY clause

Mannelig

New Member
Not very proficient with SQL. I am trying to get username, count number of login attempts and the last date of login attempt from a database table. The table schema is something like this:\[code\]username character varying,logindate timestamp,result character varying,clientip character varying\[/code\]I was able to get the username and number of attempts from the following query:\[code\]SELECT USERNAME, COUNT(USERNAME) FROM LOGINTABLE GROUP BY USERNAME\[/code\]Is it possible to get the date for last login from the same query? Please advice. DB Used: POSTGRESQL
 
Top