最近我导入了一个新的数据库,在我的本地机器上进行开发,但它不起作用:ENUM列仅在没有引号的情况下发送变量时才起作用.这是一个例子:
mysql.local>select count(*) from psh_products where active = 1;
+----------+
| count(*) |
+----------+
| 72782 |
+----------+
1 row in set (0.04 sec)
mysql.local>select count(*) from psh_products where active = '1';
+----------+
| count(*) |
+----------+
| 0 |
+----------+
1 row in set (0.00 sec)
Run Code Online (Sandbox Code Playgroud)
如果你想知道表结构:
CREATE TABLE `psh_products` (
`productID` int(12) unsigned NOT NULL AUTO_INCREMENT,
`catID` int(2) unsigned NOT NULL,
`main_sku` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`sku` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`shortsku` varchar(255) COLLATE utf8_unicode_ci NOT …Run Code Online (Sandbox Code Playgroud)