# @products = Product.find\_by\_sql "SELECT \*...... "

**URL:** <https://www.ruby-forum.com/t/products-product-find-by-sql-select/97264>\
**Category:** Rails\
**Created:** [July 6, 2006, 1:02am UTC](https://www.ruby-forum.com/t/products-product-find-by-sql-select/97264 "2006-07-06T01:02:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/b77776/32.png) [@rey](https://www.ruby-forum.com/u/rey)\
**Post date:** [July 6, 2006, 1:02am UTC](https://www.ruby-forum.com/t/products-product-find-by-sql-select/97264/1 "2006-07-06T01:02:03Z")

</div>

hello all

i have a trouble whit a controller

i need filter the collection by a date, but i dont know how to get the  
values of a date, because i need that values to build my sql sentences

for example:

```
@products = Product.find_by_sql "SELECT * FROM products WHERE 

```

cdbl(date\_availabe) \> " + first\_date\_double\_value + " AND  
cdbl(date\_available) \<= " + second\_date\_double\_value

first\_date\_double\_value & second\_date\_double\_value

are the values that i dont know how to get

neither taking of Date.today value

please i need your help  
tanks
