Using postgres.
My SQL is incredibly rusty and I'd greatly appreciate some advice to help me overcome my problem.
I want to find situations where 2+ cars were sold at exactly the same time, were the same make, but were different models
If I COUNT(model) OVER (PARTITION BY timestamp, make) I also get situations where cars of the same model are included in the view with no way to filter them out.
I have tried using distinct count: COUNT(DISTINCT model) OVER (PARTITION BY timestamp, make), which would work perfectly however counting distinct whilst partitioning is not allowed.
I would ideally like a solution where I don't have to join to the same table using an inequality join as I'm going to be querying a large dataset and performance is important.
Apologies if the solution to this is incredibly simple but, for the life of me, I cannot work it out.
Current output:
Desired output:
Note: I don't care about the count column, it was just to help describe the problem
Thanks very much

