i wish to select id from table where name = ‘fahim’
Table name is Info and columns are id and name
how to write a query in console
i wish to select id from table where name = ‘fahim’
Table name is Info and columns are id and name
how to write a query in console
If you are talking about the console of MySQL query then you can write
as
below.
SELECT id FROM Info WHERE name = ‘fahim’
Else if you are talking about the ActiveRecord Query in rails then write
it
like this.
Info.select(“id”).where(:name => “fahim”)
This query would return you the ActiveRelation object containing the ids
from Info where name is fahim.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs