# ActiveRecord and attributes returned

**URL:** <https://www.ruby-forum.com/t/activerecord-and-attributes-returned/111994>\
**Category:** Rails\
**Created:** [August 14, 2007, 3:41am UTC](https://www.ruby-forum.com/t/activerecord-and-attributes-returned/111994 "2007-08-14T03:41:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Scott\_Parks](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ac8455/32.png) [@Scott\_Parks](https://www.ruby-forum.com/u/Scott_Parks)\
**Post date:** [August 14, 2007, 3:41am UTC](https://www.ruby-forum.com/t/activerecord-and-attributes-returned/111994/1 "2007-08-14T03:41:41Z")

</div>

I am working with a couple of queries where I need to get the  
latitude and longitude from a  
table based on the zip code I pass to it.

@geoLatitude = Geodemog.find\_by\_sql[“select latitude from geodemogs  
where post\_code = ?”, @query]

I want to:

1. Make sure this is the best way to do this since the table holds a  
lot of records
2. Am I setting this up properly to be able to send a second query to  
Mysql where I will  
use the variable @geoLatitude to do the actual calculations?

Thank you in advance for your help!

-Scott
