On 05/23/2018 08:04 PM, tango ward wrote:
On Thu, May 24, 2018 at 10:55 AM, David G. Johnston
<david.g.johnston@xxxxxxxxx <mailto:david.g.johnston@xxxxxxxxx>> wrote:
On Wednesday, May 23, 2018, Adrian Klaver <adrian.klaver@xxxxxxxxxxx
<mailto:adrian.klaver@xxxxxxxxxxx>> wrote:
INSERT INTO my_table(%s, %s)
WHERE NOT EXISTS(SELECT name FROM my_table WHERE name= %s)
INSERT doesn't have a where clause...
David J.
What I did is
'''INSERT INTO my_table(name, age)
SELECT %s, %s
WHERE NOT EXISTS(SELECT name FROM my_table WHERE name=%s)''', ('Scott', 23)
I doubt that worked, you have three parameter markers(%s) and two
parameter values. Not only that two of the markers are for identifiers.
--
Adrian Klaver
adrian.klaver@xxxxxxxxxxx