Reputation: 78254
I have three tables T1, T2, and T3 with hte following columns.
T1: a, b
T2 b, c
T3 c,d
I want to create a view called T4 with fields a,d
How do I write a query to do this?
Upvotes: 2
Views: 54
Reputation: 13465
Try this ::
CREATE VIEW T4
AS
SELECT
T1.a,
T3.d
FROM T1
INNER JOIN T2 ON T1.b = T2.b
INNER JOIN T3 ON T2.c = T3.c
Upvotes: 1
Reputation: 32602
You can join them like this:
CREATE VIEW T4 AS
SELECT T1.a, T3.d
FROM T1
JOIN T2 ON T1.b = T2.b
JOIN T3 ON T2.c = T3.c
Upvotes: 1