Problem in has_and_belongs_to_many data retrieval

I use this code to select all the record with name = 'g'
@resulttag = Tag.find(:all, :conditions => "name = 'g'")

Then I want to select all related Entries record, by this code
@r = @resulttag.entries

But it is not work, @r still storing the same data with @resulttag
array storing Tag records, not Entry records)

It's not working because @resulttag is an array of tags, not a single
@resulttag.entries.collect(&:entries) will give you an array
containing an array for each tag, or if you want an array with all
@resulttag.entries.collect(&:entries).flatten will do the job

You could also approach it the other way round:

Entry.find_by_sql <<_SQL
   SELECT * from entries
   INNER JOIN entries_tags on = entry_id
   INNER JOIN tags on = tag_id
   where name = 'g'