Custom query

Hi,
i want to select only product id and product name from a table how
will i manage please help

M I R wrote:

Hi,
i want to select only product id and product name from a table how
will i manage please help

Use

find_by_sql(SQL statement)

or use

find_by_product_id_and_product_name…

Use

find_by_sql(SQL statement)

You can also pass :select option to your find e.g.:

Product.find :all, :select=>“id, name”

Regards,
Rimantas

http://rimantas.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