LibreOffice Base Update SQL query using three tables

Hello.

I’m new to SQL and I’m trying to find a solution how to get data from table3 to table 1 using table2 as a reference. Here’s my example:

table3
ID Color
1 Red
2 Blue
3 Black
4 Green

table2
ProductID ColorID
A 1
B 2
C 3
B 2

in table 3 I only have a ProductID and would like to have this situation:
ProductID Color
A Red
B Blue
C Black
B Blue

How is this done in Libreoffice? I appreciate the replies in advance.

In SQL this is done either with a Sub-Query or via JOIN. Some examples from sqlite:

You may also google JOIN vs Sub-SELECT as this topic can get complicated…

Open the Query editor.
Add table1, table2 and table3
Link table1.ID with table2.ColorID
Choose table2.ProductID and table1.Color
→ table3 isn’t needed.
And this is the code you created, if you switch design view off:

SELECT "table2"."ProductID", "table1"."Color"
FROM "table1", "table2" 
WHERE "table1"."ID = "table2"."ColorID"

[SQL] JOINing 2 row sets (most simple example with HSQL in Base)