简体   繁体   中英

MySQL not equals to - isn't working

I'm trying to use not equal select in PhpMtAdmin 5.6.12, MySQL client version: 5.6.12, but it seems not working:

I have tried this queries:

SELECT * FROM table WHERE field <> 05.05.2013

SELECT * FROM table WHERE field <> '05.05.2013'

SELECT * FROM table WHERE field <> "05.05.2013"

SELECT * FROM table WHERE field != 05.05.2013

SELECT * FROM table WHERE field != '05.05.2013'

SELECT * FROM table WHERE field != "05.05.2013"

SELECT * FROM table WHERE field not in ('05.05.2013')

...

I'm getting error message:

ERROR: Unclosed quote @ 38

STR: '

SQL: SELECT * FROM `table` WHERE field <> \'05.05.2013\'

If field is a date column, try this:

SELECT * FROM `table` WHERE field != '2013-05-05'

or this:

SELECT * FROM `table` WHERE field != STR_TO_DATE("05.05.2013", "%d.%m.%Y")

(assuming your date is in the format of day.month.year).

The problem was on PhpMyAdmin 5.6.12. "not equals to" works perfect on other environment.

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