❔ EF Core - Select items such that attribute sum is greater than...
Hi everyone,
I have an object Recording having attributes start_time and size_byte.
Now, when the space occupied by recordings exceeds a threshold t1, I want to delete oldest recordings until the total space occupied is below threshold t2 < t1. So I'll have to free an amount of space at least equal to
space_to_free = occupied_space - t2.
Thus I need to perform a query like
"give me the records, ordered by start_time, such that the sum of their size is >= space_to_free."
The problem is with the second part of the query, that in PostgreSQL would be like at the following article:
https://dba.stackexchange.com/a/106737
Could you please give me a hand implementing this in EF Core?
Database Administrators Stack Exchange
Select rows from T such that sum(T.quantity) is greater than an arg...
TLDR: I need a way to limit my select such that only rows needed to fill my new order are returned.
Hey, I'm looking for a better way to do a query on the simplified toy table below. Right now I d...
2 Replies
I ended up using a raw SQL query
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.