In SQL, how can I select the changed column?

I am trying to do this with SQL in Ruby:

SELECT number*2 FROM dictionary;

      

I can use .select(:number)

to get numeric columns "as is", but I don't know how to get them back. I tried this (which obviously didn't work):

current_table.select(:number*2)

      

+3


source to share


1 answer


Try any of these



@newnumber = number.find(:all, :conditions => ["id = ?", @dictionary.id], :select => "number * 2 as newnumber")

@newnumber = number.all(:conditions=>"id='#{@dictionary.id}'",:select=>"number * 2 as newnumber")

      

0


source







All Articles