I have a docket, which has many entries. I want only dockets, where none of the associating entries contains the text "PENDING". For example, if docket A has 10 entries, and one of those entries' docket_type varchar field contains the word "PENDING" anywhere, then I don't want that docket.
This is my solution:
SELECT * FROM dockets INNER JOIN entries ON entries.docket_id = docket.id WHERE (docket_type NOT LIKE '%PENDING%')
The problem is, while it does not retrieve entries that contain that text, it still retrieves the associating dockets, when those dockets contain other entries that do not contain that text. I don't want to retrieve the docket if one of its entries contains this text in docket_type.
How could I fix this?