Click here to Skip to main content
15,902,938 members

Comments by Marvin@CDM (Top 13 by date)

Marvin@CDM 19-Dec-12 16:01pm View    
Yes that now works! Thank you for your help Rohit =)
I now have 2 slightly different approaches that give me similar returns. This has been an excellent learning opportunity!
Marvin@CDM 18-Dec-12 22:50pm View    
Yes that works much better =) The only issue with this approach is it still returns site with less than 10 days reporting. There is one site in the table with only one record, that one should not be returned.
Marvin@CDM 18-Dec-12 22:41pm View    
Yep you got it. Your note about the boolean suddenly clarified it for me. Now to work out the avg...

Thank you so much Christian!
Marvin@CDM 18-Dec-12 20:36pm View    
"An expression of non-boolean type specified in a context where a condition is expected"

Marvin@CDM 18-Dec-12 20:03pm View    
Sorry i'm being dense headed. I'm not getting how you mean to filter the subquery with COUNT. Can you correct me?

SELECT COUNT(*), id, site, temp
FROM myTable as a
WHERE (
SELECT COUNT(*)
FROM myTable as b
WHERE b.site = a.site AND a.temp > 60 and a.id >= DATEADD(D , -10, DATEDIFF(D,0, GETDATE()))
)

Obviously its missing GROUP BY's also. But i'm not understanding a SELECT inside a WHERE...