P
Pete
Hopefully this isn't a duplicate. It's similar to (but not quite the same as)
the question posed by aybs10 on 2/7.
I have a table X with 500,000 rows.
The following query returns 20,000 rows:
SELECT A, B, C, D
FROM X
WHERE len(B) = 9;
The following query returns 480,000 rows:
SELECT A, B, C, D
FROM X
WHERE len(B) = 16;
But the following query returns only 490,000 rows:
SELECT A, B, C, D
FROM X
WHERE len(B) = 9;
UNION
SELECT A, B, C, D
FROM X
WHERE len(B) = 16;
Meanwhile, the following (changing the UNION to a UNION ALL) returns all
500,000:
SELECT A, B, C, D
FROM X
WHERE len(B) = 9;
UNION ALL
SELECT A, B, C, D
FROM X
WHERE len(B) = 16;
The first two queries seem to prove that length of B is always either 9
bytes or 16 bytes. But the latter two queries seem to prove that Access is
seeing 10,000 B's as simultaneously having both length 9 and length 16.
This theory is disproved by the following, which returns zero rows:
SELECT A, B, C, D
FROM X
WHERE len(B) = 9
and len(B) = 16
Anyone have any idea what's happening here?
the question posed by aybs10 on 2/7.
I have a table X with 500,000 rows.
The following query returns 20,000 rows:
SELECT A, B, C, D
FROM X
WHERE len(B) = 9;
The following query returns 480,000 rows:
SELECT A, B, C, D
FROM X
WHERE len(B) = 16;
But the following query returns only 490,000 rows:
SELECT A, B, C, D
FROM X
WHERE len(B) = 9;
UNION
SELECT A, B, C, D
FROM X
WHERE len(B) = 16;
Meanwhile, the following (changing the UNION to a UNION ALL) returns all
500,000:
SELECT A, B, C, D
FROM X
WHERE len(B) = 9;
UNION ALL
SELECT A, B, C, D
FROM X
WHERE len(B) = 16;
The first two queries seem to prove that length of B is always either 9
bytes or 16 bytes. But the latter two queries seem to prove that Access is
seeing 10,000 B's as simultaneously having both length 9 and length 16.
This theory is disproved by the following, which returns zero rows:
SELECT A, B, C, D
FROM X
WHERE len(B) = 9
and len(B) = 16
Anyone have any idea what's happening here?