首先,这是表格:
CREATE TABLE `outlet_tags` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`importer_id` int(11) NOT NULL,
`outlet_id` int(11) NOT NULL,
`code` varchar(20) NOT NULL,
`postcode` varchar(15) DEFAULT NULL,
`tag_set` varchar(45) DEFAULT NULL,
`tag_type` varchar(45) DEFAULT NULL,
`tag_details` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `fk_report_outlet_tags_1` (`importer_id`),
KEY `fk_report_outlet_tags_2` (`outlet_id`),
KEY `outlet_tag_set` (`tag_set`),
KEY `outlet_tag_type` (`tag_type`),
KEY `outlet_tag_details` (`tag_details`),
CONSTRAINT `fk_report_outlet_tags_1` FOREIGN KEY (`importer_id`) REFERENCES `importers` (`id`),
CONSTRAINT `fk_report_outlet_tags_2` FOREIGN KEY (`outlet_id`) REFERENCES `outlets` (`id`)
) ENGINE=PBXT DEFAULT CHARSET=utf8;
根据以下查询中使用的条件,任何人都可以了解字段值变化的原因吗?如果引擎是Maria,就不会发生这种情况。
select * from outlet_tags where code=1503 and outlet_id=407 limit 3;
+------+-------------+-----------+------+----------+---------+-----------------+----------------+
| id | importer_id | outlet_id | code | postcode | tag_set | tag_type | tag_details |
+------+-------------+-----------+------+----------+---------+-----------------+----------------+
| 222 | 1 | 407 | 1503 | XXX XXX | outlet | Make up | Make up |
| 675 | 1 | 407 | 1503 | XXX XXX | outlet | Approved Status | Approved |
| 1619 | 1 | 407 | 1503 | XXX XXX | outlet | Retail Area | No Retail Area |
+------+-------------+-----------+------+----------+---------+-----------------+----------------+
3 rows in set (0.00 sec)
select * from outlet_tags where code=1503 and importer_id=1 limit 3;
+------+-------------+-----------+------+----------+---------+-----------------+----------------+
| id | importer_id | outlet_id | code | postcode | tag_set | tag_type | tag_details |
+------+-------------+-----------+------+----------+---------+-----------------+----------------+
| 222 | 1 | 407 | 1503 | XXX XXX | outlet | Make up | Make up |
| 675 | 1 | 407 | 1503 | XXX XXX | outlet | Approved Status | Approved |
| 1619 | 1 | 407 | 1503 | XXX XXX | outlet | Retail Area | No Retail Area |
+------+-------------+-----------+------+----------+---------+-----------------+----------------+
3 rows in set (0.00 sec)
select * from outlet_tags where importer_id=1 and outlet_id=407 limit 3;
+------+-------------+-----------+------+----------+---------+----------+-------------+
| id | importer_id | outlet_id | code | postcode | tag_set | tag_type | tag_details |
+------+-------------+-----------+------+----------+---------+----------+-------------+
| 222 | 1 | 407 | 1503 | NULL | NULL | NULL | NULL |
| 675 | 1 | 407 | 1503 | NULL | NULL | NULL | NULL |
| 1619 | 1 | 407 | 1503 | NULL | NULL | NULL | NULL |
+------+-------------+-----------+------+----------+---------+----------+-------------+
3 rows in set (0.00 sec)
更新:自MariaDB 5.5 PBXT was dropped as a storage engine
起答案 0 :(得分:1)
尝试在查询中使用ORDER BY。
不同的引擎可能会以不同的顺序返回行,具体取决于行的检索方式。