简体   繁体   中英

MySQL query breaks on certain WHERE condition

I have a MySQL query that only crashes on one certain where clause, it says the table has crashed and needs to be repaired .

This query works:

SELECT
    DirectionId
FROM
    Messages
WHERE
    CustomField1 = 56 AND DirectionId = 1

This one does not

SELECT
    DirectionId
FROM
    Messages
WHERE
    CustomField1 = 209 AND DirectionId = 1

But if I do this it works:

SELECT
    DirectionId
FROM
    Messages
WHERE
    CustomField1 = 209

Or this it also works

SELECT
    DirectionId
FROM
    Messages
WHERE
    DirectionId = 1

Any ideas?

Try to use the MySQL internal cleanup routines to repair your INDEXes:

Type this on the MySQL CLI:

REPAIR TABLE Messages

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