Hello I have a MySQL database and I can run the following script using the command prompt SELECT location, SUM(IF(gender='M',1,0)) AS M, SUM(IF(gender='F',1,0)) AS F FROM locations INNER JOIN employees USING (loc_code) GROUP BY location; this also works within Zope but when I try to run this from the python prompt I get an File "<stdin>", line 1 b.execute('SELECT location, SUM(IF(gender='M',1,0)) AS M, SUM(IF(gender='F',1,0)) AS F FROM locations INNER JOIN employees USING (loc_code) GROUP BY location') ^ SyntaxError: invalid syntax this is what I did
import MySQLdb db = MySQLdb.connect(db='mydb',user='myuser',passwd='mypasswd') b = db.cursor() b.execute('myquery')
error any ideas thanks norman ps perhaps this post is more suited to the python mail list, please forgive as I am only a member of the zope community.;^) zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zz/********/z/****\zzz|****\*\zz|*******|z z/^^^^^^^^/z/******\zz|*^^^^|*|z|*|^^^^^|z norman khine zzzzzz/**/z|**/^^\**|z|*|zzz|*|z|*|zzzzzzz mailto:norman@khine.net zzzzz/**/zz|*|zzzz|*|z|****/*/zz|*****|zzz purley z/******/zz|*|zzzz|*|z|*|^^zzzzz|*|^^^|zzz UK zzZ/**/zzzz|**\^^/**|z|*|zzzzzzz|*|zzzzzzz zz/******/zz\******/zz|*|zzzzzzz|*|*****|z z/^^^^^^/zzzz\^^^^/zzz|^|zzzzzzz|^^^^^^^|z zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz