I was wondering why can\'t I use alias in a count(*) and reference it in the having clause. For instance:
select Store_id as StoreId, count(*) as _count
Here is my contribution (based on the code posted here):
select * from ( SELECT Store_id as StoreId, Count(*) as StoreCount FROM StoreProduct group by Store_id ) data where data.StoreCount > 0