1

I want to make a join between the table people and vehicles, which both share this value,

in the people table the field is vehicles

["https://swapi.dev/api/vehicles/14/","https://swapi.dev/api/vehicles/30/"]

and in the vehicles table the field is url

https://swapi.dev/api/vehicles/14/

As you can see in the first one there is like a list of strings, how could I do the query? is sqlite

I tried this, but does not work

SELECT *
FROM people
INNER JOIN vehicles
ON people.vehicles = vehicles.url 

you can see the endpoints here: https://swapi.dev/api/people/ https://swapi.dev/api/vehicles/

also i see this post How to join array of strings? but it didn't solve my problem

2
  • SQLite does not support arrays. What is the actual data in the vehicles column in the people table? Commented Jul 23, 2021 at 5:11
  • @TimBiegeleisen this: ["https://swapi.dev/api/vehicles/14/","https://swapi.dev/api/vehicles/30/"] thats the data Commented Jul 23, 2021 at 15:40

1 Answer 1

0
SELECT *
FROM people
INNER JOIN vehicles
ON people.vehicles like '%'+ vehicles.url  +'%'
Sign up to request clarification or add additional context in comments.

2 Comments

Hi , that's return me nothing, does not work :/ please can keep me helping?
0 SELECT * FROM people INNER JOIN vehicles ON people.vehicles like CONCAT('%', vehicles.url ,'%')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.