Django complex distinct based on timestamp

11 Views Asked by At

community, need a bit of help:

Having hard time with implementing business rules in my query:

I have a model Entity with field 'timestamp' for example I have 10 instances of Entity for 24 hours. I need to distinct() or exclude() Entities if they have timestamp in range of 30 minutes between them. So if I have 8 instances with interval of 1 hour and 2 instances with interval of 30 minutes, I need to output count of 9 instances. Hope it's a clear explanation of what I'm looking for. Please refer any helpful documentation or article on complex querying. Thanks!

litterally have no idea how to do it.

0

There are 0 best solutions below