I am currently using QGIS and it's database tool with custom plugins. I have to update a specific Table using an SQL query but I cannot use Database specific programs like PostGIS. Here is the test query I used:

"BAL"."BAL_ADRESSE" = "BAL2"."bal_adresse"
WHERE "BAL"."BAL_ADRESSE" != "BAL2"."bal_adresse";

It is quite a simple query, I am trying to replace values in the first BAL table using a csv I created myself and imported in the same database afterwards, calling it BAL2. Yet everytime I try to do anything than basic selections, like the update I need to do, it returns an error message and never the same.

So here are my questions: Is my query wrong? And is QGIS unable to use the UPDATE query?

closed as off-topic by Vince, mgri, MaryBeth, John Powell, whyzar Sep 25 '17 at 13:20

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This problem cannot or can no longer be reproduced. Changes to the system or to the asker's circumstances may have rendered the question obsolete, or the question does not include a procedure to enable potential answerers to reproduce the same symptoms. Such questions are off-topic as they are unlikely to help future readers, but editing them to include more details can lead to re-opening." – Vince, mgri, MaryBeth, John Powell, whyzar
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    We need an exact error message, but you appear to have syntax errors all over the place. Joining on a not-equals is going to cause polynomial expansion. – Vince Sep 25 '17 at 11:50
  • The previous version was like this: UPDATE TABLE "BAL" SET "BAL"."BAL_ADRESSE" = "BAL2"."bal_adresse" FROM "BAL", "BAL2" WHERE "BAL2"."bal_pk_uid" = "BAL"."BAL_PK_UID"; And it wasn't working any better. It always gices me back a synthax error near table or near the first dot. – Moreau Colin Sep 25 '17 at 11:52
  • 1
    1) never use uppercase table or column names, 2) consult documentation for proper UPDATE syntax, 3) There is no GIS component to this question, so this would be better asked in Database Administrators – Vince Sep 25 '17 at 12:03

Well, it worked after tinkering with it for almost an hour i found out this worked as intended:

"BAL_ADRESSE" = (Select "BAL2"."bal_adress"
WHERE "BAL2"."bal_pk_uid" = "BAL"."BAL_PK_UID");
  • That should produce an error as well -- BAL3 is undefined. – Vince Sep 25 '17 at 12:09
  • Oops, edited: It was BAL not BAL 3 – Moreau Colin Sep 25 '17 at 12:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.