Prev: Case sensitivity
Next: Weird deadlock issue
From: brunoalsantos on 3 Aug 2010 08:00 On 2 ago, 15:33, ChrisC <cunningham...(a)gmail.com> wrote: > Using rank() and union all: > > select * From ( > select *, rank() over(order by table_order) as rank from( > Select *, 1 as table_order from A > where <cond> > union all > select *, 2 as table_order from B > where <cond> > ) x > ) y > where rank = 1 > > You'll probably want to call out the columns in the outer select > specifically (to at least get rid of the table_order and rank > columns). Thank you danfan46, Tonkuma and Chris. |