0

I have two arrays: Question and UserProfile

  • The
    userProfiles
    : [] array contain
    { id, name }
    objects
  • The
    questions
    : [] array contains
    { id, text, createdBy }
    objects

The

createdBy
integer in questions is always one of the id values in
userProfiles
.

Is there a way I could "join" the arrays in much the same way as I would join up two SQL tables if I was using a database.

What I need as an end result is an array that contains

{ id, text, name }

Corresponding SQL would be:

SELECT u.id, q.text, u.name 
FROM userProfiles u 
JOIN questions q ON q.createdBy=u.id
Anonymous Asked question May 13, 2021