I'm trying to count the number of distinct occurrences while using where and having. However, the result isn't quite what I need. Although I get the data returned that I want it's returned as multiple rows; I just want one total.
Here is the query I've developed so far:
inner join device_mst on device_mst.dev_id = hdd_smart_log.dev_id
hdd_smart_log.slice_date <= curdate()
and hdd_smart_log.slice_date >= curdate() - 7
sum(pending_sector) > 800
And I receive this back from the query: (47 rows showing one per row)
What I would like is one result: 47.
Where is the error in my query?