I need to get data from these two documents. I need to join user.id with push.stats[*].memberId. What is the way to achieve this since * isn’t the way?
SELECT push.memberId, u.email, u.first_name, u.last_name, u.phone, push.message_id msgId
FROM default ml UNNEST ml.push.status push
LEFT JOIN default u ON KEYS ml.push.status[*].memberId
WHERE ml.type = ‘message_log’
AND ml.src_type = ‘0’
AND ml.src_id = ‘040ecddbf2319a3b5183347cd9f1ff5b’
I’ve got the solution now, am not sure if its good or bad. I’ve used this following query-
SELECT push.memberId, u.email, u.first_name, u.last_name, u.phone, push.message_id pushStatus
FROM default ml UNNEST ml.push.status push
LEFT JOIN default u ON KEYS ‘user::’ || push.memberId
WHERE ml.type = ‘message_log’
AND (ml.src_type = ‘0’ OR ml.src_type = 0)
AND ml.src_id = ‘040ecddbf2319a3b5183347cd9f1ff5b’
I did the UNNEST and then I did the join with inner key.