Complex SQL query

How would I make the following query a rest query in to dreamfactory?

SELECT id, name,( 3959 * acos( cos( radians(33) ) * cos( radians( 33 ) ) * cos( radians( -117 ) - radians(-117) ) + sin( radians(33) ) * sin( radians( 33 ) ) ) ) AS distance FROM wu_object HAVING distance < 10 ORDER BY distance LIMIT 0 , 10;

Hi @garreeoke, I suggest you do a stored procedure.

https://wiki.dreamfactory.com/DreamFactory/Tutorials/Querying_stored_procedures

best regards,

Hi ,

Were you able to achieve this . I require exactly the same thing done i.e. get all nearby locations from a table storing the lattitudes and longitudes , based on input lattitude and longitude.

In general , can you build a select queryon a table that takes as input a bind variable ( or literal) and expose that as REST using DF ?

Okay , I used the stored procedure method. Works very well for me . Let me know if you want any details on the implementation.
Cheers .