List Info

Thread: How to pass parameter with LIKE




How to pass parameter with LIKE
user name
2006-10-25 10:01:02
On 25-10-2006, Janice Sterling wrote:
> --===============0689749057==
> Content-Type: multipart/alternative; 
>
	boundary="----=_Part_18939_12219789.1161749671700"
;
>
> ------=_Part_18939_12219789.1161749671700
> Content-Type: text/plain; charset=ISO-8859-1;
format=flowed
> Content-Transfer-Encoding: 7bit
> Content-Disposition: inline
>
> I am trying to use a sql query where i'm passing a
parameter
>
> sql_str = "SELECT mrc_code FROM blocks where
mrc_code LIKE '%s'" % (blkfld)
>
> where blocks would be 31103a1, 31103e1, 31103a5,
31103e5

you want to do 

select mrc_code from blocks where mrc_code in ('31103a1',
'31103e1', 
'31103a5', '31103e5')

isnt'it ?

-- 
William Dodé - http://flibuste.net

_______________________________________________
DB-SIG maillist  -  DB-SIGpython.org
http:/
/mail.python.org/mailman/listinfo/db-sig
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )