fork download
  1. CREATE TABLE updatetable(
  2. id INTEGER,
  3. name VARCHAR(100),
  4. indicator_flag CHAR(1)
  5. )
  6.  
  7. CREATE TABLE othertable(
  8. id INTEGER,
  9. name VARCHAR(100),
  10. indicator_flag CHAR(1)
  11. )
  12.  
  13. INSERT INTO updatetable VALUES(1,'Teradata',null);
  14. INSERT INTO updatetable VALUES(2,'Database',null);
  15. INSERT INTO updatetable VALUES(3,'Oracle',null);
  16. INSERT INTO updatetable VALUES(4,'Vertica',null);
  17.  
  18. INSERT INTO othertable VALUES(1,'Teradata','Y');
  19. INSERT INTO othertable VALUES(2,'Database','N');
  20. INSERT INTO othertable VALUES(5,'DB2','Y');
  21. INSERT INTO othertable VALUES(6,'MYSQL','Y');
  22.  
  23. UPDATE tempAggr
  24. FROM updatetable as tempAggr,
  25. othertable as tempTableAlias
  26. SET indicator_flag = tempTableAlias.indicator_flag
  27. WHERE tempAggr.id = tempTableAlias.id;
  28.  
  29. select * from updatetable
Success #stdin #stdout #stderr 0.01s 5508KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Error: near line 1: near "CREATE": syntax error
Error: near line 14: no such table: updatetable
Error: near line 15: no such table: updatetable
Error: near line 16: no such table: updatetable
Error: near line 18: no such table: othertable
Error: near line 19: no such table: othertable
Error: near line 20: no such table: othertable
Error: near line 21: no such table: othertable
Error: near line 23: near "FROM": syntax error
Error: near line 29: no such table: updatetable