Hello,
I'm posting here because I'm hoping to get some help with my query. I'm running into a problem where I have 2 similarly formatted arrays with the same index but when I try to join them in a JSON SQL query on that index it doesn't return anything. I tried looking up this issue and saw that a couple people have run into it but I never saw a solution that worked. Down below is a picture of the query I'm using
The end goal of this is to join the arrays and be able to return only the oeEEIDarray entries that arent in the nyfEEIDarray.
The only issue seems to be the JOIN function on these arrays as I can query them both separately with WHERE clauses.
Thank you for the welcome, and no I haven't. I've not the most familiar with lodash's capabilities, what would be a high level overview of how to leverage those 2 functions?
Okay, so I just tried that and instead of returning a list of unique entries returns array with both sets of data. I'm using similar data for both arrays so this shouldn't be the case . Is it not working as intended b/c my arrays are of key:value pairs?
That filters in all the unique values, and it's definitely a step in the right direction but would there be a way to return items from only one of these arrays?
To use your code above as an example: Would there be a way to return just [{"employee_id":1}]?
The reasoning behind this is bc array1 is an earlier set of data and array2 is more recent. I'm trying to see which "employee_id" values are no longer being received. Let me know if I can explain anything better.
This would solve my whole conundrum haha. Thank you!
edit: I'm going to try using this in the JSON SQL query, don't know why I didn't realize that's what this is for initially
I think it all depends on what the data looks like, if you're looking for differences between the two that is different than joining them and only returning unique values....
I am still not clear on what you need to accomplish....
And I want to get the entries unique to just array1, so just uniquearray = [{"employee_id":1}]. In my original post I was doing a left join b/c I wanted to see:
WHERE array2.employee_id IS NULL
I hope any of that made sense haha ,but please let me know if you want me to elaborate more.
For testing, can you replace the oeEEIDarray.data and nyfEEIDarray.data calls in your nesting query to just contain a sample dataset?
I feel like there is maybe an extra layer to your data that we aren't seeing -- if you can get my example to work with the simple array sets we can compare the structures and see if they are different.