I am trying to retrieve a list of transaction IDS that only contain at least 5 product IDS, the baskets could have many more product IDS but it must contain these 5 also.
My table looks something like this:
| transaction_id | trans_date | product_id | store_id |
The table is all at
product_id line level detail, nothing is rolled up.
select * from Transactions where trans_date in ('2019-03-07','2019-03-06','2019-03-08','2019-03-09','2019-03-10') and product_id in ('000000000021003503','000000000060280873','000000000060281480','000000000060281642','000000000020059281')
This is recovering all the transactions that contain these ids but I need it to be rolled up to a transaction level, so if the transaction_id contained these ids (at least) then its included.
Hopefully this makes sense