It might be a **Repeated Question**, but my problem is not solving.

I am trying to determine the Inward and Outward of Item using Date

tables.  

- In table 1, We will call it `A` for short. I would have three columns
 namely `A_Dt`, `A_Na`, `A_Qty`
 - In table 2, We will call it 'B' for short. I would have three columns namely `B_Dt`, `B_N`a,`B_Qty`

- In table 3, We will call it 'C' for short. I would
 have three columns namely `C_Dt`, `C_N`a, `C_Qty`

Table A and B are inward and C are outward.

I had used the revised query but adding the Third column.

Table Example:  

```
Table :A

    A_Dt         A_Na  A_Qty
    2016-08-01    XY     50
    2016-08-02    XY     100
    2016-08-05    XY     150

```

Table B:

```
B_Dt       B_Na  B_Qty
2016-08-01  XY  150
2016-08-03  XY  100
2016-08-04  XY  200

```

Table C:

```
C_Dt       C_Na  C_Qty
2016-08-01  XY  150
2016-08-03  XY  100
2016-08-04  XY  200

```

Expected Output

```
Date           Inward   Outward
2016-08-01      200      150
2016-08-02      100      0
2016-08-03      100      100
2016-08-04      200      200
2016-08-05      150      0

```

Well, in this case I should use left join or following query must be worked.

Query:

```
select t.Dt as Date, sum(t.Qty) as Inward,sum(t.outward) as outward1 from(
    select A_Dt as Dt, A_Na as Na, A_Qty as Qty from a
    union all
    select B_Dt as Dt, B_Na as Na, B_Qty as Qty from b
    union all
    select C_Dt as Dt, C_Na as Na, C_Qty as outward from c
)t
group by t.Dt, t.Na
order by t.Dt;

```

Following Error:

```
#1054 - Unknown column 't.outward' in 'field list' 

```

Any thoughts would be great.Thanks in advance.