Sasi Reddy

Sasi Reddy

  • NA
  • 346
  • 226.8k

Aggregate function query

Oct 13 2014 10:02 AM
SELECT
COUNT(DISTINCT(CONVERT(VARCHAR(10), Logintime, 101)))
AS COUNT
FROM
UserLoginStatus where UserId=15
HAVING DATEDIFF(MINUTE,MIN(Logintime),MAX(Logouttime))< 480
 
 
above i need to fetch Month(Logintime)  in where condition .
 
if i keep in query it is showing empty otherwise it is showing count as 2
 
how to do that one 

Answers (3)