def check_agg_loc_join_1(db, t1, t2, r1, r2):
    # given radius r1, r2
    q = """select %s.id, count(*) from %s, %s where
      circle (point(%s.latitude, %s.longitude), %%s) ~
      circle (point(%s.latitude, %s.longitude), %%s)
      group by %s.id""" % (t1, t1, t2, t1, t1, t2, t2, t1)
    return db.execute(q, (r1, r2)).fetchall()
dataset/ETHPy150Open sirrice/dbtruck/dbtruck/analyze/fuzzyjoin.py/check_agg_loc_join_1/original