I'm getting a headache trying to figure this out. Even after watching this explainer video I still can't manage to achieve this ๐ค
I want to:
RETURN ALL RECORDS FROM part WHERE category=X NOT IN progress WHERE user=auth_id AND category=X
or, in human terms:
I want to retrieve all records from the "part" table where the "category" is "X", but only those records that are not present in the "progress" table where the "user" is "auth_id" and the "category" is "X".
The first thing I can't get my head around is which table I should be querying.
I'm assuming the "part" table.
Is that right?
NB: each record in the "progress" table (associated with a user) references a record from the "part" table (not associated with a user).
Any help greatly appreciated.
[EDIT] Below is what ChatGPT suggested me to do, but I'd like to make sure this is a good/efficient/scalable way to achieve what I'm after (my database will contain huge amounts of records, so the tiniest of performance improvements could make a significant difference). NB: the custom query on the screenshot is obsolete; it is "db:progress.part_id==null AND db:part.course_id==input:course_id".