Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Pinaki.

Asked: December 10, 2016 - 3:04 am UTC

Last updated: December 11, 2016 - 4:24 am UTC

Version: 11g

Viewed 1000+ times

You Asked

Hi Tom ,

Please see the below query :

select financial_transaction_nk , max(financial_transaction_dim_key)
from FTD where FTD.financial_transaction_nk in
(select financial_transaction_nk from FTD where financial_transaction_dim_key in (select financial_transaction_key from LEF where not exists
(select 1 from FTD where LEF.fianancial_transaction_key = FTD.financial_transaction_dim_key and sysdate between sysdate -200 and sysdate-100)))
group by financial_transaction_nk;

The above query works fine. But i need to display the financial_transaction_dim_key also along with their maximum values. group by clause not allowing other attributes than grouping attributes.So how i can display the each financial_transaction_dim_key along with their maximum values if i group by them with financial_transaction_nk.

example :

financial_transaction_nk financial_transaction_dim_key max(financial_transaction_dim_key)

1 100 100
1 90 100
2 150 500
2 500 500




Could you help with this situation.

Thanks



and Connor said...

Check out the KEEP clause in Analytics

I've done a youtube video on it here

https://www.youtube.com/watch?v=kUN319lW0O8


Is this answer out of date? If it is, please let us know via a Comment