I get a response from a JSON API which contains the following data.
"data": [
{
"num1": 1,
"num2": 2,
"txt1": "test3"
},
{
"num1": 4,
"num2": 5,
"txt1": "test6"
}
]
Next, I have a database table that looks much the same.
|----------------|
| my_table |
|----------------|
| num1 |
| num2 |
| txt1 |
|----------------|
Now I need to get all the rows in the table that match any of the elements in the data array.
SELECT * FROM my_table AS t
LEFT JOIN array AS a
ON t.num1 = a.num1 AND t.num2 = a.num2 AND t.txt1 = a.txt1
But of course, I can't treat the array like it's a table. Or can I? How would I solve this?
By the way, I'm writing in Python and I'm using SQLObject library. But this should not make much of a difference.