Just to show another way of doing it ...
Not suggesting that it's any better mind (I doubt that it would be), but it would be interesting to see a performance comparison of the two methods. * hint hint *Code:Select id, parent_id, active, source From ( Select source, id, parent_id, active, Min(source) Over (Partition By id) min_id_source From ( Select 'A' source, id, parent_id, active From a Union All Select 'B', id, parent_id, active From b ) ) Where source = min_id_source /




Reply With Quote