question

sarahandSQL avatar image
sarahandSQL asked

How to I solved the ' 'select' is not valid at this position' error I am getting?

It should show me the two columns in the table 'booking', guestNo & hotelNo, when hotelNo = 2. However, when i hover on select It says its invalid and I get a 1064 error (so I know its a syntax error).

select guestNo, hotelNo,

from booking,

WHERE hotelNo = 2;

Can someone tell me where I am going wrong???

sqlerrorerror messageerror handling
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

anthony.green avatar image
anthony.green answered

you have extra commas in wrong places.

first theres an extra one after "hotelno" and an extra one after "booking"

It should look like this

select guestNo, hotelNo
from booking 
WHERE hotelNo = 2; 
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Kev Riley avatar image
Kev Riley answered

Remove the commas after hotelNo and booking

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.