因此,如果尝试运行此查询:
-- Make sure the variable is typed to a single value...
SET @my_id=300;
SELECT `my_id` INTO @my_id
FROM `my_table` WHERE `field_1`= 123 AND `field_2`IS NULL;
...然后我收到此错误:
[Err] 1172 - Result consisted of more than one row
但是,如果我运行此选择:
SELECT COUNT(*)
FROM `my_table` WHERE `field_1`= 123 AND `field_2`IS NULL;
...然后它返回零(即没有匹配)。零如何大于一?