Hi, I would like to know if it was possible to make a search between two values : For example, I have a table Assignation : - name (varchar) - frequency (integer) - created_on (date) And I would like to sort all the names of the assignation which have a frequency betwenn 100 kHz and 500 kHz, or sort all the names that has been created between two given dates. For the moment, the only thing I can do is sort the names of the assignation which has a given frequency, but I can''t sort the names of the assignations whose frequency is between two given frequencies. So I would like to know how to do it. Thanks for the replies. -- Posted via http://www.ruby-forum.com/.
MAILER-DAEMON@mailadmin.wku.edu
2006-Jul-05 21:28 UTC
[Rails] How to make a search between two values ?
Please do not send unsolicited mail to wku.edu email accounts. If you feel that your message was rejected in error please contact 270-745-7000
Cl?lia Nev wrote:> I would like to know if it was possible to make a search between two values : > > For example, I have a table Assignation : > - name (varchar) > - frequency (integer) > - created_on (date) > > And I would like to sort all the names of the assignation which have a > frequency betwenn 100 kHz and 500 kHz, or sort all the names that has > been created between two given dates. > > For the moment, the only thing I can do is sort the names of the > assignation which has a given frequency, but I can''t sort the names of > the assignations whose frequency is between two given frequencies. So I > would like to know how to do it.You can always use :conditions to specify a range for values - the SQL "IN" operator is good for range tests. But it''s probably easier to use the ez_where plugin. http://agilewebdevelopment.com/plugins/ez_where -- Josh Susser http://blog.hasmanythrough.com -- Posted via http://www.ruby-forum.com/.