# Sql statement works on local box but not on server?

**URL:** <https://www.ruby-forum.com/t/sql-statement-works-on-local-box-but-not-on-server/80852>\
**Category:** Rails\
**Created:** [December 31, 2006, 6:15am UTC](https://www.ruby-forum.com/t/sql-statement-works-on-local-box-but-not-on-server/80852 "2006-12-31T06:15:32Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![koloa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/4bbf92/32.png) [@koloa](https://www.ruby-forum.com/u/koloa)\
**Post date:** [December 31, 2006, 6:15am UTC](https://www.ruby-forum.com/t/sql-statement-works-on-local-box-but-not-on-server/80852/1 "2006-12-31T06:15:32Z")

</div>

hi, i have this statement

User.find\_by\_sql (“SELECT Users.id, COUNT(Howtos.user\_id) FROM Howtos,  
Users WHERE Howtos.user\_id = Users.id GROUP BY Users.id”)

this works on my local setup, but when i moved my application to another  
server, i get an error message that my Howtos table does not exist.

thoughts?

---

<div class="post-metadata">

**Author:** ![koloa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/4bbf92/32.png) [@koloa](https://www.ruby-forum.com/u/koloa)\
**Post date:** [December 31, 2006, 6:51am UTC](https://www.ruby-forum.com/t/sql-statement-works-on-local-box-but-not-on-server/80852/2 "2006-12-31T06:51:42Z")

</div>

Was your migrations successful? Did you check the database to see if it  
really is there?

---

<div class="post-metadata">

**Author:** ![koloa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/4bbf92/32.png) [@koloa](https://www.ruby-forum.com/u/koloa)\
**Post date:** [December 31, 2006, 7:08am UTC](https://www.ruby-forum.com/t/sql-statement-works-on-local-box-but-not-on-server/80852/3 "2006-12-31T07:08:08Z")

</div>

yes, i have other functions that i call that accesses the howto table  
and display that in a view… hmmmm.

---

<div class="post-metadata">

**Author:** ![koloa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/4bbf92/32.png) [@koloa](https://www.ruby-forum.com/u/koloa)\
**Post date:** [December 31, 2006, 7:21am UTC](https://www.ruby-forum.com/t/sql-statement-works-on-local-box-but-not-on-server/80852/4 "2006-12-31T07:21:46Z")

</div>

Hi, please try running the SQL query on the remote machine at the  
command line for the db engine. Then report the error message that  
you’re receiving.

-Conrad

---

<div class="post-metadata">

**Author:** ![koloa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/4bbf92/32.png) [@koloa](https://www.ruby-forum.com/u/koloa)\
**Post date:** [December 31, 2006, 7:28am UTC](https://www.ruby-forum.com/t/sql-statement-works-on-local-box-but-not-on-server/80852/5 "2006-12-31T07:28:57Z")

</div>

hello, here is what i got

mysql\> SELECT Users.id, Users.login, COUNT(Howtos.user\_id) as numhowtos  
FROM Howtos, Users WHERE Howtos.user\_id = Users.id GROUP BY Users.id;

ERROR 1146 (42S02): Table ‘myname\_myfirstapp.Howtos’ doesn’t exist

Conrad T. wrote:

> Hi, please try running the SQL query on the remote machine at the  
> command line for the db engine. Then report the error message that  
> you’re receiving.
> 
> -Conrad

---

<div class="post-metadata">

**Author:** ![koloa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/4bbf92/32.png) [@koloa](https://www.ruby-forum.com/u/koloa)\
**Post date:** [December 31, 2006, 7:47am UTC](https://www.ruby-forum.com/t/sql-statement-works-on-local-box-but-not-on-server/80852/6 "2006-12-31T07:47:48Z")

</div>

Hi, try using ‘howtos’ instead of ‘Howtos’ for your table name. Let  
me know what happens.

-Conrad

---

<div class="post-metadata">

**Author:** ![koloa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/4bbf92/32.png) [@koloa](https://www.ruby-forum.com/u/koloa)\
**Post date:** [December 31, 2006, 7:31am UTC](https://www.ruby-forum.com/t/sql-statement-works-on-local-box-but-not-on-server/80852/7 "2006-12-31T07:31:01Z")

</div>

i have other functions that i call on my howtos table that populate my  
index page. after i comment out the sql statement, my other functions  
work fine…im not sure what is happening.

---

<div class="post-metadata">

**Author:** ![koloa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/4bbf92/32.png) [@koloa](https://www.ruby-forum.com/u/koloa)\
**Post date:** [December 31, 2006, 4:30pm UTC](https://www.ruby-forum.com/t/sql-statement-works-on-local-box-but-not-on-server/80852/8 "2006-12-31T16:30:52Z")

</div>

Hi Conrad, Awesome thanks!

it started working when i made everything lower case.

much appreciation to all!
