Apologies for the bad english.
One day I saw a question like this but can’t find it anymore:
I have 2 tables.
- Class
- Aproved_class
Lets say:
In Class
table this records:
“id”: 1,
“name”: “Maths”,
“correlativity”: 1,
"id": 2,
"name": "Science",
"correlativity": 1,2,
"id": 3,
"name": "Economics",
"correlativity": 1,2,3
In aproved_class
:
“id”: 1,
“user_id”: “1”,
“aproved_class”: 1
"id": 2,
"user_id": "1",
"aproved_class": 2
So, first i make a query with the user and other with the aproved class, which returns:
Query of user results: {"aproved":[{"aproved_class":"1"},{"aproved_class":"2"}]
What I need is simply, receive the id of correlativity based on the list of the first query.
Lets say:
[{“aproved_class”: 1}] -> Get maths (correlativity 1)
[{“aproved_class”: 1},{“aproved_class”: 2}] -> Get maths and science (correlativity 1,2)
[{“aproved_class”: 1},{“aproved_class”: 2},{“aproved_class”: 3] -> Get maths, science and physics (correlativity 1,2,3)
I tried everything since a lot of time, even spliting the “correlativity” field and no luck.