I have written a query that returns a record count as 1017414. Now I have done UNION using exactly same query. When I UNION the two exaclty same queries it should return the same record count which it return when ran individually but after union, it is returning record count as 991166
Any idea why this is happening?
Remember that a UNION will remove duplicate rows (from Query1 and Query2).
Have you tried using 'UNION ALL' instead?