Ok, this has been driving me nuts since yesterday. All documentation of mysql 5.0 says this should work but my mysql-server simply rejects this statement:
INSERT INTO Husstand (adresse, stad, postnr) SELECT 'adresse', 'by', 'ptr' FROM dual WHERE not exists (SELECT * FROM Husstand WHERE Husstand.adresse = 'adresse' AND Husstand.stad = 'by' AND Husstand.postnr = 'ptr');
Basically I want to insert the three values into the 'Husstand' table if those values are not already present. I am given an error on the not exists syntax and don't know what I am doing wrong. Can anyone give me some pointers?
That would be most helpful!
INSERT INTO Husstand (adresse, stad, postnr) SELECT 'adresse', 'by', 'ptr' FROM dual WHERE not exists (SELECT * FROM Husstand WHERE Husstand.adresse = 'adresse' AND Husstand.stad = 'by' AND Husstand.postnr = 'ptr');
Basically I want to insert the three values into the 'Husstand' table if those values are not already present. I am given an error on the not exists syntax and don't know what I am doing wrong. Can anyone give me some pointers?
That would be most helpful!