[DB-SIG] Re: [meta-sig] select statement for python-mysql

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Mon, 7 Oct 2002 08:45:08 -0700 (PDT)


> > im facing a problem with the syntax in python-mysql. this is my code:
> >
> >
>
> The syntax for the string substitution needs to have a '%' instead of a ','
>
> c.execute("""select vid from verses where
> book,chapter,number=%s,%s,%s""" %(bk,chap,i))

[redirected to db-sig]

The syntax of that select SQL statement itself looks funny to me; are you
sure you don't mean this instead?

     select vid from verses
     where book = %s
       and chapter = %s
       and number = %s

Good luck!