sql - Adding argument to SELECT statement with UNION changes record number -


when add new argument select clause of union, more records... how can be? isn't union mashing them together? example:

edit: they're absolutely distinct. code column either "in" or "out", , that's i'm using separate two.

edit2: union gives me 80 records, should, it's odd because 2 select statements absolutely distinct.

final edit: ultimate problem records within 1 of select statements being not distinct, not between 2 select statements. all.

-- yields 76 records select        f.date      , f.code      , f.cost   a.fact f   f.code = 'in' union select        f2.date      , f2.code      , f2.cost   a.fact2 f2   f2.code = 'out' ;  -- yields 80 records select        f.key      , f.date      , f.code      , f.cost   a.fact f   f.code = 'in' union select        f2.key      , f2.date      , f2.code      , f2.cost   a.fact2 f2   f2.code = 'out' ; 

by default union selects distinct results, there must duplicates between result sets.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -