Select Acctnum ; from Checks ; Where checks.type = '1' ; into cursor tmp1 Select Acctnum ; from Checks ; Where Acctnum not in (Select Acctnum from tmp1) ; Into Cursor tmp2 Select * ; from tmp1 ; union ; Select * ; from tmp2 ; Into cursor tmpFinalThanks in Advance!!