我希望下面的错误是自我解释的。我想将 event_time 与一些 cart_time 进行比较。我知道通常当我们想要这样的任何操作时,我们需要使用in
,但是对于时间戳如何比较它
mysql> SELECT bsid
FROM access_aug15
WHERE event_time < (SELECT cart_time
FROM chat_final
WHERE bsid in (SELECT bsid
FROM access_aug15
WHERE eventid="11"
AND current_page not like '%cart%'));
ERROR 1242 (21000): Subquery returns more than 1 row
编辑:表结构 access_aug15
+-------------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+--------------+------+-----+---------+-------+
| vid | varchar(200) | YES | | NULL | |
| bsid | varchar(200) | YES | MUL | NULL | |
| event_time | datetime | YES | MUL | NULL | |
| eventid | varchar(10) | YES | MUL | NULL | |
| current_page | mediumtext | YES | | NULL | |
| departmentid | varchar(100) | YES | MUL | NULL | |
| form_id | varchar(100) | YES | | NULL | |
| form_name | varchar(100) | YES | | NULL | |
| page_title | varchar(200) | YES | | NULL | |
| report_date | datetime | YES | MUL | NULL | |
+-------------------+--------------+------+-----+---------+-------+
表 2:chat_final
+-------------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+--------------+------+-----+---------+-------+
| bsid | varchar(200) | YES | MUL | NULL | |
| chat_time | datetime | YES | | NULL | |
| cart_time | datetime | YES | | NULL | |
| customerid | varchar(100) | YES | | NULL | |
| detail | longtext | YES | | NULL | |
| chat_type | varchar(5) | YES | | NULL | |
+-------------------+--------------+------+-----+---------+-------+