I'm porting some code from PHP to Ruby and have decided on using
Sequel.  I have a query that uses some math functions to determine a
distance...

$query = 'SELECT *, ( 3963 * ACOS( COS( RADIANS(' .$lat. ') ) * COS
( RADIANS( lat ) ) * COS( RADIANS(lng) - RADIANS(' .$lng. ') ) + SIN
( RADIANS(' .$lat. ') ) * SIN( RADIANS( lat ) ) ) ) AS distance FROM
locations HAVING distance < 5000 ORDER BY distance ASC';

I'm trying to figure out how I can get this to work with Sequel.  As
far as I can tell there isn't a way to use raw SQL with dataset.filter
().  I'm trying to avoid using ActiveRecord as I want to leave myself
with the option of running this code outside of Rails.

Can anyone point me in the right direction here?  Surely this is
possible to do w/ Sequel.

Regards,

-Matt Tuzzolo
-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.


Reply via email to