How to fix this Syntax error in query expression?

480 views Asked by At

I am working on Standard Access. I wrote this code:

SELECT *
FROM room
WHERE price < 40 AND
type IN ('Double", "Single")
ORDER BY price;

when I run it, it's telling me this message

Syntax error in string in query expression price < 40 AND type IN ('Double", "Single") ORDER BY price;

2

There are 2 answers

0
Mureinik On BEST ANSWER

String literals in SQL are denoted by single quotes, not double quotes:

SELECT * FROM room WHERE price < 40 AND type IN ('Double', 'Single') ORDER BY price
0
Gustav On

You cannot mix single- and double-quotes. Also, type is a reserved word. So try:

SELECT *
FROM room
WHERE price < 40 AND [type] IN ("Double", "Single")
ORDER BY price;