hi,
I have a table TAGS with idkey and two colums (NAME, COUNT):

id|NAME|COUNT
53|black metal|3
55|occult rock|3
61|satanic smurfs|1
62|beer|0
63|pizza|0

I want to check if some tag exist by checking if `NAME` is recorded
in the table or not. If not, I want to add it;

INSERT INTO TAGS ( NAME, COUNT ) SELECT 'magnetohydrodynamics', 1
FROM TAGS WHERE NOT EXISTS (SELECT * FROM TAGS WHERE NAME =
'magnetohydrodynamics' );

then if I look up in the table I see:

id|NAME|COUNT
53|black metal|3
55|occult rock|3
61|satanic smurfs|1
62|beer|0
63|pizza|0
64|magnetohydrodynamics|1
65|magnetohydrodynamics|1
66|magnetohydrodynamics|1
67|magnetohydrodynamics|1
68|magnetohydrodynamics|1

could you tell me please where I did some mess ?

regards,
Nicolas J.

Reply via email to