The minimum distance from each house to all the stores is calculated
because the data are grouped by house. The HAVING clause specifies that each
row be evaluated to determine if its value of DIST is the same as the minimum
distance for that house to any store.
group by house
having dist=min(dist);