I'm supposed to run this query in PGadmin:
SELECT
n2.cpr,
n2.adresseringsnavn,
n2."fødselsdato" AS foedselsdato,
n2.morcpr,
n1.mor_navn,
n2.farcpr,
n3.far_navn
FROM
(SELECT * FROM data.cpr_aktivkom_geoview WHERE
cpr = 'x' OR
cpr = 'x' OR
cpr = 'x' OR
cpr = 'x' OR
cpr = 'x' OR
cpr = 'x' OR
cpr = 'x' OR
cpr = 'x' OR
cpr = 'x' OR
cpr = 'x' OR
cpr = 'x') n2
INNER JOIN
(SELECT cpr, adresseringsnavn AS mor_navn
FROM data.cpr_aktivkom_geoview) n1
ON n2.morcpr = n1.cpr
LEFT JOIN
(SELECT cpr, adresseringsnavn AS far_navn
FROM data.cpr_aktivkom_geoview) n3
ON n2.farcpr = n3.cpr
ORDER BY n2."fødselsdato" asc
ERROR: syntax error at or near "."
LINE 2: n2.cpr,
^
SQL state: 42601
Character: 14
What is the problem with the dot after the n2's, n1's and n3's?
WHERE
clauses. Are you executing exactly this, or along with other queries?n2
alias (the query againstdata.cpr_aktivkom_geoview
)? Agreed with Charlieface too, are you running exactly this query or did you change it and / or are running other queries with it?...it's odd that the inner query ofn2
has the sameOR
clause repeated 11 times.