嗨我正在尝试在postgreSql表中执行以下操作,但遇到语法问题。PostgreSQL如果表A不包含值,则插入到表A和表B中
伪代码:
if (tableA.column1 does not contain value1)
{
INSERT INTO tableA (column1, column2)
VALUES value1, value2
}
// do this check even if the above already existed
if (tableB does not contain value1 and value3 in the same row)
{
// it is ok if value1 and value3 already exist in the table, just not the same row
INSERT INTO tableB (column1, column2)
VALUES (value1, value3)
}
return true
与此操作的实际语法任何帮助,将不胜感激!
我不明白第一个和第二个条件是如何“归属”在一起的。你可以简单地运行两个彼此独立。 – 2013-03-22 14:12:49
有趣,现在我看着它,你说得很好! – dcoffey3296 2013-03-22 14:16:55