Suppose I have a table: name type a 1 a 2 b 1 c 2 d null How can I select out the name, based on the fact If there is a type of 1 and 2, take the 2, if there's only a 1, take the 1, and if there's a null, make it a 1? I was thinking this: SELECT .... WHERE MAX(nvl(table.type, 1)) in (1,2) Is that the most efficient way?
Forum Rules
Bookmarks