|
-
You need another SELECT wrapped round it.
(BTW: NVL(w_lifestyle.date_updated, w_lifestyle.date_created) is less typing than the CASE).
SELECT * FROM (
SELECT w_person.hurn,
CASE WHEN w_lifestyle.date_updated IS NULL
THEN w_lifestyle.date_created
ELSE w_lifestyle.date_updated END highest_date,
w_lifestyle.gross_family_income,
row_number() over
(PARTITION BY hurn ORDER BY highest_date desc) rn
from w_lifestyle, w_person
where w_lifestyle.purn = w_person.purn
and w_lifestyle.gross_family_income is not null
and w_lifestyle.gross_family_income <> 'Z'
and w_lifestyle.gross_family_income <> 'X'
and w_lifestyle.gross_family_income <> ' '
) where rn = 1
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|