简体   繁体   中英

What am I doing wrong with this MySQL Query?

I am simply trying to query some data, and I am using multiple WHERE options for the first time, and I do not know where I am going wrong:

SELECT *
FROM carlist
WHERE MilesPerGallon > 20
AND Weight is BETWEEN 2000 AND 3000;

MySQL Workbench keeps giving me an X near my first line: X Near First Line in MySQL Workbench

And the system reports ErrorCode 1064: Error with Syntax.

Any thoughts?

Try this:

SELECT *
FROM carlist
WHERE MilesPerGallon > 20
AND Weight BETWEEN 2000 AND 3000; -- removed is

Just saw the comment by @GrumpyCrouton! Posted simultaneously. Drop is before BETWEEN..AND.. .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM