[DB-SIG] Re: [meta-sig] select statement for python-mysql
Eugene V. Dvurechenski
jno@glasnet.ru
Wed, 9 Oct 2002 14:01:07 +0400
On Mon, Oct 07, 2002 at 08:45:08AM -0700, Danny Yoo wrote:
>>> > > 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
oops, sorry - previous reply was in russian ;-)
Oracle allows this way of coding:
ROAMING@ROAMING> select * from user_list where (User_ID,Realm_ID,Log_ID) in ((5,16,65))
Prefix_ID=NULL
User_ID=5
Realm_ID=16
Log_ID=65
Status='W'
Sim_Sessions=NULL
Setup=4
# SELECT executed in 0.01 seconds
# 1 record fetched (103.64 records per second)
--
SY,
jno (PRIVATE PERSON) [ http://www.glasnet.ru/~jno ]
a TeleRoss techie [ http://www.aviation.ru/ ]
If God meant man to fly, He'd have given him more money.