3
Reply

Aggregate function query

Sasi Reddy

Sasi Reddy

9 years ago
729
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)