0

In the following sql statement (using pgAdmin 4): field_1 comes from table_1 field_2 comes from table_2 Why do I need to place field_1 in quotes, but not field_1? Is there a better way to write this query?

SELECT "field_1", field_2 FROM table_1 
INNER JOIN table_2 ON "field_1" = table_2.id
ORDER BY field_2
SimonRH
  • 1,409
  • 2
  • 13
  • 23
  • 1
    What is the actual column name of `field_1`? If you have to escape it with quotes, it's probably a reserved word. – Aaron Dietz Nov 01 '19 at 19:20
  • @TheImpaler: "backticks" are illegal in SQL identifiers. –  Nov 01 '19 at 23:31
  • 1
    https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS –  Nov 01 '19 at 23:31

0 Answers0