How to make a search between two values?

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.

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 S.
http://blog.hasmanythrough.com

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs