Home > DeveloperSection > Forums > Syntax error near the keyword order [on hold] in SQL Server
Manoj Bhatt
Manoj Bhatt

Total Post:153

Points:1079
Posted on    September-22-2014 2:50 AM

 Database Database 
Ratings:


 1 Reply(s)
 801  View(s)
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?



Anchal Kesharwani
Anchal Kesharwani

Total Post:10

Points:70
Posted on    September-22-2014 3:00 AM

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.


Don't want to miss updates? Please click the below button!

Follow MindStick