SQL Query Question
Scott Barron
kain at dynup.net
Wed Jun 7 18:09:24 EDT 2000
Perhaps you are looking for something like this:
query_string = "SELECT AAA FROM BBB WHERE cc = %s"
then you could do:
query_function (query_string % `pp`) # if pp is an integer type
or
query_function (query_string % pp) # if pp is a string type
or change %s to %d or whatever, depending on what pp is.
-Scott
In article <8hm9as$ho3$1 at news-int.gatech.edu>, liang at cad.gatech.edu
(Shengquan Liang) wrote:
>
>
> if i need a variable to be used as the creteria for selection, how do i
> construct the query?
>
> say i have a variable pp=1000 in the program and i'd like to use the
> following query:
> SELECT AAA FROM BBB where cc = 1000
>
> if i want to replace that 1000 with the variable 'pp' in the Python
> program, how do i modify the query statement?
>
> thanks.
More information about the Python-list
mailing list