# Syntax error on SQL statement

**URL:** <https://www.ruby-forum.com/t/syntax-error-on-sql-statement/126361>\
**Category:** Ruby\
**Created:** [January 17, 2008, 6:37pm UTC](https://www.ruby-forum.com/t/syntax-error-on-sql-statement/126361 "2008-01-17T18:37:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [January 17, 2008, 6:37pm UTC](https://www.ruby-forum.com/t/syntax-error-on-sql-statement/126361/1 "2008-01-17T18:37:59Z")

</div>

Hi,

I’m using the latest version of Ruby for Fedora Core 6 Linux. I want  
to write concise SQL statements, but the following

@subscriber = Subscriber.find(:first, :conditions =\> “pharmacy\_id  
= ?”, @pharmacy\_id)

is giving me the error:

SyntaxError  
/usr/local/apache2/htdocs/easyrx/app/controllers/  
register\_controller.rb:44: syntax error, unexpected ‘)’, expecting  
tASSOC  
@subscriber = Subscriber.find(:first, :conditions =\> “pharmacy\_id  
= ?”, @pharmacy\_id)

What’s the correct way to write the statement?

Thanks, - Dave

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [January 17, 2008, 7:28pm UTC](https://www.ruby-forum.com/t/syntax-error-on-sql-statement/126361/2 "2008-01-17T19:28:02Z")

</div>

On 17 Jan 2008, at 17:06, removed\_email\_address@domain.invalid wrote:

> Hi,
> 
> I’m using the latest version of Ruby for Fedora Core 6 Linux. I want  
> to write concise SQL statements, but the following
> 
> @subscriber = Subscriber.find(:first, :conditions =\> “pharmacy\_id  
> = ?”, @pharmacy\_id)
> 
> @subscriber = Subscriber.find(:first, :conditions =\> [“pharmacy\_id  
> = ?”, @pharmacy\_id])

Fred
