Greetings,
So, for work, I have two queries, A and B. When run by itself, A returns 1 row (with 1 varchar column) and B returns 1984 rows (with 1 varchar column). Neither A nor B, by themselves, return any null results.
However, when I run the following:
A
UNION ALL
B
17 of the resulting 1985 rows are null. Union returns 1963 (of the expected 1985) rows, 22 of which are presumably consolidated into the single "null" that shouldn't exist.
I find it bizarre that Union and Union All return null rows when the queries that compose them don't return any null rows. Further, I find it odd that the number of null rows varies!
Any ideas what can cause this, oh ye SQL gods?
As always, much obliged for your help.
So, for work, I have two queries, A and B. When run by itself, A returns 1 row (with 1 varchar column) and B returns 1984 rows (with 1 varchar column). Neither A nor B, by themselves, return any null results.
However, when I run the following:
A
UNION ALL
B
17 of the resulting 1985 rows are null. Union returns 1963 (of the expected 1985) rows, 22 of which are presumably consolidated into the single "null" that shouldn't exist.
I find it bizarre that Union and Union All return null rows when the queries that compose them don't return any null rows. Further, I find it odd that the number of null rows varies!
Any ideas what can cause this, oh ye SQL gods?
As always, much obliged for your help.