我有以下查询,它返回 250 条记录:
SELECT DISTINCT p.* FROM Persons AS p
INNER JOIN Colors AS c ON c.ColorId = p.FavoriteColorId
WHERE p.Name = 'John Doe' AND c.ColorName IN ('RED','BLUE','YELLOW')
LIMIT 240,10;
-- Returns 198 records
SELECT DISTINCT p.* FROM Persons AS p
INNER JOIN Colors AS c ON c.ColorId = p.FavoriteColorId
WHERE p.Name = 'John Doe' AND c.ColorName IN ('RED','BLUE','YELLOW')
-- Returns 250 records. Why?
SELECT DISTINCT COUNT(*) FROM Persons AS p
INNER JOIN Colors AS c ON c.ColorId = p.FavoriteColorId
WHERE p.Name = 'John Doe' AND c.ColorName IN ('RED','BLUE','YELLOW')
当我执行上述操作时,即使总共有 250 条记录,我也看不到任何记录。LIMIT
当我将 更改为时,它才开始返回记录LIMIT 197,10
,然后我看到 1 条记录。
为什么会这样?