Sorry I wasn't sure how to title this question but I'll do my best to explain my problem. I have two tables in my DB that look like this:
APPLICATIONS:
app_id | data1 | data2
----------------------
1 | foo | foo
2 | bar | bar
APP_REQUIREMENTS:
app_id | requirement | is_satisfied
--------------------------------------
1 | requirement1 | false
1 | requirement2 | false
2 | requirement1 | true
2 | requirement2 | true
What I am trying to do is query my DB to get all information from the APPLICATIONS table along with an extra field that represents whether there are any UNSATISFIED requirements for that application so my query would return something like this:
app_id | data1 | data2 | meets_all_requirements
------------------------------------------------
1 | foo | foo | false
2 | bar | bar | true
What would be the best way to do this with one query? Is there a better way to set up my tables/relationships to accommodate this?
Any advice is greatly appreciated!