Syntax Error
Near keyword 'FROM', expected 'FROM', 'JOIN', 'LATERAL', 'CROSS APPLY', 'INNER JOIN', 'FULL OUTER JOIN', 'LEFT JOIN', 'RIGHT JOIN', 'FULL OUTER JOIN', 'CROSS JOIN', 'GROUP BY', or 'HAVING', got 'FROM' instead
What This Error Means
This error occurs when SQL expects a specific keyword or operator but encounters a different one instead. In this case, it's expecting a keyword related to joining or grouping data, but it finds the keyword 'FROM' again.
Why It Happens
This error typically happens when a developer writes a query with a repeated keyword, usually 'FROM', or uses a keyword in an incorrect context. It can also occur when a developer copies and pastes code without adjusting the correct keyword or operator.
How to Fix It
- 1To fix this error, review the SQL query and identify the incorrect keyword or operator. Replace the repeated keyword with the correct one, or adjust the keyword to match the expected syntax. Make sure to check the context of the keyword and adjust accordingly.
Example Code Solution
SELECT * FROM table1 FROM table2;SELECT * FROM table1 JOIN table2;Fix for Near keyword 'FROM', expected 'FROM', 'JOIN', 'LATERAL', 'CROSS APPLY', 'INNER JOIN', 'FULL OUTER JOIN', 'LEFT JOIN', 'RIGHT JOIN', 'FULL OUTER JOIN', 'CROSS JOIN', 'GROUP BY', or 'HAVING', got 'FROM' instead
Browse Related Clusters
Related SQL Errors
Related SQL Blog Articles
Have a different error? Get an instant explanation.
Explain Another Error