# Query depending on between two values

**URL:** <https://www.ruby-forum.com/t/query-depending-on-between-two-values/131953>\
**Category:** Rails\
**Created:** [March 14, 2008, 6:30pm UTC](https://www.ruby-forum.com/t/query-depending-on-between-two-values/131953 "2008-03-14T18:30:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![subhadip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3d9bf3/32.png) [@subhadip](https://www.ruby-forum.com/u/subhadip)\
**Post date:** [March 14, 2008, 6:30pm UTC](https://www.ruby-forum.com/t/query-depending-on-between-two-values/131953/1 "2008-03-14T18:30:50Z")

</div>

hey, i am new in ruby…i have two textbox…where i will give  
two dates.i will fire query for retriving data between two dates  
given textboxes…pleaes give me any simple code.how will i proceed?  
urgent…  
controller code:  
@result = params[:text]  
@result1 = params[:text1]  
@infos=Info.find(:all,:conditions =\>  
{:user\_id=\>params[:text]…params[:text1]})  
but it will not worked?  
please help with code…

---

<div class="post-metadata">

**Author:** ![subhadip](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/3d9bf3/32.png) [@subhadip](https://www.ruby-forum.com/u/subhadip)\
**Post date:** [March 15, 2008, 5:49pm UTC](https://www.ruby-forum.com/t/query-depending-on-between-two-values/131953/2 "2008-03-15T17:49:32Z")

</div>

here’s one way:

@infos = Info.find(:all, :conditions =\> [“my\_date between ? and ?”,  
params[:date1], params[:date2]])

On Mar 14, 1:30 pm, Subhadip Chakraborty \<rails-mailing-l…@andreas-
