All pastes #656561 Raw Edit

Anonymous

public text v1 · immutable
#656561 ·published 2007-08-14 06:07 UTC
rendered paste body
create view listing_point_distance as
        select *, sqrt(
                        pow(latitude - point_latitude, 2) +
                        pow((longitude - point_longitude) *
                                cos(point_latitude * pi() / 180), 2)
                  ) * 69.09 as distance
        from listing, point order by distance;

mysql> select count(*) from listing_point_distance;

(can't show header, it's outside of the scroll buffer)
|   226015 | 
|   226015 | 
|   226015 | 
|   226015 | 
|   226015 | 
|   226015 | 
|   226015 | 
|   226015 | 
|   226015 | 
<snip>
+----------+
226015 rows in set (0.33 sec)