the tables habe the data like this
create table t1 (a1 int,b1 int ,c1 int)
create table t2 (a2 int,b2 int ,c2 int)
create table t3 (a3 int,b3 int ,c3 int)
insert into t1 values(1,5,6),(5,8,4)
insert into t2 values(5,8,9),(1,4,4)
insert into t2 values(6,2,7),(7,6,0)
i want the output like below
(c1+c2+c3)
----------
22
8
What I have tried:
WITH
b1(a1, b1,c1) AS (select * from t1),
b2(a2,b2,c2) AS (select * from t2),
b3(a3,b3,c3)as (select * from t3),
b4(csjdls) as (( select c1+c2+c3 from b1,b2,b3))
SELECT csjdls
FROM b4
i tried the above it iw working fine when only table having only one record
but i want to for multiple records