SYNTAX ERROR NEAR THE KEYWORD ORDER [ON HOLD] IN SQL SERVER

Manoj Bhatt

Total Post:154

Points:1086
Posted by  Manoj Bhatt
 1073  View(s)
Ratings:
Rate this:

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?

  1. Anchal Kesharwani

    Post:10

    Points:70
    Re: Syntax error near the keyword order [on hold] in SQL Server

    hi 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.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!