# Mysql adapter : "as" in the query

**URL:** <https://www.ruby-forum.com/t/mysql-adapter-as-in-the-query/129726>\
**Category:** Rails\
**Created:** [February 21, 2008, 1:07am UTC](https://www.ruby-forum.com/t/mysql-adapter-as-in-the-query/129726 "2008-02-21T01:07:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stephanwehner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/0ea827/32.png) [@stephanwehner](https://www.ruby-forum.com/u/stephanwehner)\
**Post date:** [February 21, 2008, 1:07am UTC](https://www.ruby-forum.com/t/mysql-adapter-as-in-the-query/129726/1 "2008-02-21T01:07:51Z")

</div>

Migrating here from SQL Server to mysql; found something that “worked”  
under SQL Server (with freetds / odbc) but not mysql.

# cat db/migrate/005\_create\_noodles.rb

class CreateNoodles \< ActiveRecord::Migration  
def self.up  
create\_table :noodles do |t|

```
  t.integer :girth
end

```

end

def self.down  
drop\_table :noodles  
end  
end

# rake db:migrate

# script/console\>\> Noodle.create(:girth =\> 4)

=\> #\<Noodle id: 1, girth: 4\>

> > Noodle.find(:first, :select =\> ‘girth as width’).width  
> > =\> “4”
> 
> > \_.class  
> > =\> String

Under SQL Server would get “Fixnum” instead of String. Fixnum makes more  
sense.

I get the impression the Mysql::Result#each\_hash method is responsible.

What should it be?

Stephan
