SQL Query Syntax Error - Spaces in Field Names SQL Query Syntax Error - Spaces in Field Names sql sql

SQL Query Syntax Error - Spaces in Field Names


I don't think you can use quotes around the actual table name; only the name you assign to it. I would wrap the table in brackets instead: [OV2 BAS]

You also can't put quotes around your joining syntax either. Try this instead:

SELECT * FROM [OV2 BAS] AS bas INNER JOIN [OV2 RefID] AS ids ON bas.[Ref ID] = ids.[Ref ID] WHERE ids.ENUM_H = 'TDischarge';


Replace ' with

  • postgreSQL, Oracle: "
  • MySQL `
  • SQL-server: [ and ]

For example: "OV2 BAS", bas."Ref ID" = ids."Ref ID", etc.


For Microsoft Access, wrap field names that contain spaces with back ticks e.g. SELECT `Eng Units` FROM Table