我在 MySQL 服务器中遇到了一个非常奇怪的问题
当我执行例如:
EXPLAIN EXTENDED SELECT PRODNO,
DT,
FLAG1,
FLAG2,
`ORDER`,
`QUANTITY`,
`CARRYOVER`,
`RETURNS`,
`QUANTITY` + `CARRYOVER` - `RETURNS` AS `TOTALMARKET`
FROM (SELECT NAME_CONST('_DATE',_binary'2011-02-20' COLLATE 'binary') AS wdt
UNION ALL
SELECT DATE(DATE_SUB( NAME_CONST('_DATE',_binary'2011-02-20' COLLATE 'binary'), INTERVAL 1 WEEK )) AS wdt
UNION ALL
SELECT DATE(DATE_SUB( NAME_CONST('_DATE',_binary'2011-02-20' COLLATE 'binary'), INTERVAL 2 WEEK )) AS wdt
UNION ALL
SELECT DATE(DATE_SUB( NAME_CONST('_DATE',_binary'2011-02-20' COLLATE 'binary'), INTERVAL 3 WEEK )) AS wdt
UNION ALL
SELECT DATE(DATE_SUB( NAME_CONST('_DATE',_binary'2011-02-20' COLLATE 'binary'), INTERVAL 4 WEEK )) AS wdt
) days
JOIN bbproduct b
ON b.dt = days.wdt
WHERE ROUTENO = NAME_CONST('_ROUTENO',3)
ORDER BY DT DESC,
PRODNO ASC
服务器版本:5.1.31-community
这只会关闭 MySQL 服务器。可能出了什么问题?
答案1
问题就出在那些COLLATE 'binary'
东西上。