3
Reply

Aggregate function query

Sasi Reddy

Sasi Reddy

Oct 13 2014 10:02 AM
719
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)