2013-12-14

Hello I've been stuck with one SQL query for my assignment and was hoping for some help.

I need to get the Project ID for the best executed project -the project where (VERY_GOOD record count + GOOD record count) - (VERY_BAD record count + BAD record count) is greatest

My schema and test records in database (HSQLDB)

And test data:

(I removed unrelated fields from tables)

So with this data I have 3 good records and 2 bad, I would need to get the project which has the highest 'rating', which according to this right now would be Clean the house with 3 good ratings over 2 negative for other project.

Maybe someone would figure this out, thanks!

Show more