PeopleSoft Adoption Made Smooth & Simple!
On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool. Claim Your Free WalkMe Account Now
WITH NarrowedTable AS (select id, email from tmp_test where (lastname like 't%')), ExtraEmailsTable AS (select id from NarrowedTable union select id from tmp_test tt where (coalesce(tt.email, '') > '') and (tt.email in (select email from narrowedtable))), InnerTable AS( SELECT row_number() over(partition by email order by priority) as myrank, id, email, lastname from tmp_test tt where (coalesce(Email, '') > '') and (tt.id in (select id from ExtraEmailsTable)) union SELECT 1 as myrank, id, email, lastname from tmp_test tt where (coalesce(Email, '') = '') and (tt.id in (select id from ExtraEmailsTable))) select * from InnerTable where myrank = 1 order by Email, lastname;
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.