Query design in SQL - ORDER BY SUM() of field in rows which meet a certain condition
- by Christian Mann
OK, so I have two tables I'm working with - project and service, simplified thus:
project
-------
id PK
name str
service
-------
project_id FK for project
time_start int (timestamp)
time_stop int (timestamp)
One-to-Many relationship.
Now, I want to return (preferably with one query) a list of an arbitrary number of projects, sorted by the…