I'm not sure there's an easy way to do that in one query. I don't think grouping and ordering is going to work how you are expecting. Are you able to see what SQL gets generated for this query?
Is running separate queries for each budget OK?
I'm not sure there's an easy way to do that in one query. I don't think grouping and ordering is going to work how you are expecting. Are you able to see what SQL gets generated for this query?
Is running separate queries for each budget OK?