I m trying to pass multiple parameters to sql query but it is throwing me with error,
here is the query
cbd_id=[1,10,19,31,37,42,48,57,63,64,65]
cursor.execute('''select t1.id as pid,pxval,pyval from <tbl1> t1 left join (select * from <tbl2> where clubid=? t2 on t1.id=t2.projectid where t1.cityid in (SELECT cityid FROM <tbl3> WHERE cbdid =? group by cityid) and t1.pxval>0 and t2.distance is null order by projectid)''',(cbd_id[i],cbd_id[i]))
And it give me error
ProgrammingError: ('42000', "[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near 't2'. (102) (SQLExecDirectW)")
But I checked couldn't identify the problem,
Any suggestion on this will be helpful.
Thanks
t2alias. Should beselect t1.id as pid,pxval,pyval from <tbl1> t1 left join (select * from <tbl2> where clubid=?) t2.