Answer the question
In order to leave comments, you need to log in
How to fix error: ambiguous column reference?
This is what the request looks like
INSERT INTO users (balance, steamid, name, avatar)
VALUES (0, $1, $2, $3)
ON CONFLICT (steamid) DO
UPDATE SET name = $2, avatar = $3 WHERE steamid = $1;
CREATE TABLE users (
id BIGSERIAL NOT NULL PRIMARY KEY,
balance INTEGER NOT NULL,
steamid VARCHAR(50) NOT NULL UNIQUE,
name VARCHAR(50) NOT NULL,
avatar VARCHAR(100) NOT NULL,
tradelink_token VARCHAR(20),
tradelink_partner VARCHAR(20)
);
Answer the question
In order to leave comments, you need to log in
Because instead of waiting for an answer, you need to read the documentation!
Normally your request should look like this:
INSERT INTO users (balance, steamid, name, avatar)
VALUES (0, $1, $2, $3)
ON CONFLICT (steamid) DO
UPDATE SET name = excluded.name,
avatar = excluded.avatav;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question