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. 

On Wednesday, September 12, 2012 4:56:22 PM UTC+5, Fahim Patel wrote:
>
>
>
> 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 
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/RamqbD8PTFAJ.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to