vendredi 30 septembre 2016

Is there any alternative of in operator in where clause for active record query in rails

sql query for my rails query is given below... When I m running query indiviually for each destination id ,total time is less compare to if I run it with in operator. SELECT DISTINCT requested_trips.id FROM requested_trips INNER JOIN requested_trips_destinations ON requested_trips_destinations.requested_trip_id = requested_trips.id INNER JOIN destinations ON destinations.id = requested_trips_destinations.destination_id WHERE (requested_trips.status = 'Active' and requested_trips.trip_stage = 4 and (destinations.id in (64,100,545,...)))

Aucun commentaire:

Enregistrer un commentaire