When I execute this query:
SELECT
orders.id, orders.order - time, orders.pizza.id,
orders.pizza.type, orders.pizza-size, orders.quantity,
FROM
orders
INNER JOIN
permit ON orders.id = pizza.id
WHERE
([username] = @username)
I got an array:
Syntax error near the keyword order
Any clue how to solve this?
Aryan Kumar
28-Apr-2023The error "Syntax error near the keyword order" in SQL Server usually occurs when there is a syntax error in your SQL statement involving the "ORDER BY" clause.
Here are some possible causes and solutions:
Here's an example of a correct syntax for an ORDER BY clause:
Make sure that your SQL statement follows this format and that there are no syntax errors or punctuation mistakes.
Anchal Kesharwani
22-Sep-2014hi manoj,
I hope that this is helpful for you.
Since you have no order by clause and the error message is complaining about your statement near the order keyword, I explain that there are two possibilities.
The first is that you've left the s of one of your table specifiers, using order instead of orders, despite your transcription.
The second is that orders.order-time is incorrect, being treated as orders.order - time. In fact, I'd be a little worried by many of your names, including those that have two periods (.) in them. You may want to check if the - and the subsequent . characters should be underscores (_) instead.
You also have a trailing comma after the last column selection (before the from), which is not valid SQL.