Skip to content
Advertisement

Filtering records when a particular event occurs

I have the following dataset that lists payments made onto an account, the type of payment (either a regular payment, interest payment or additional payment) and the date of the payments.

Most accounts will simply have a REG payment made each month, however I want to pull out the ones that made both a REG and an ADD on the same date.

The query I have, below, will give me all the REG’s and ADDs but will not group these by the ID. So I end up with a bunch of REG only accounts.

My ideal output would look like this :

Can anyone help? I feel like I am missing something obvious

Advertisement

Answer

You can use exists:

Or, if you only want the id/date combinations:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement