I have payments data and I need to find latest date for payment which is 'Normal', so it cant be Fee or Fee pay and I am stuck. Could you please assist? so in this case I need data to bring me '12-07-2018' only as this is the latest normal payments. I cannot filter by 'Normal' as it is actually coded with randomly assigned numbers as well as Fee pay.
I am stuck how my case when should look like and how can I filter this data out..
SELECT T.Date, T.Amount, T.Text
FROM (SELECT a.RTVLDT AS Date, a.BLPS AS Amount, a.TXFT AS Text,
CASE WHEN a.RTVLDT=a.RTVLDT AND A.TXFT in ('Fee') THEN A.RTVLDT as Last_Transaction
FROM data a
) as T
GROUP BY T.Date, T.Amount, T.Text