I am trying to use result cell of main query in subquery.
I have two tables
first table is telephone
| id | name | month |
|---|---|---|
| 151 | raj | Jan_2021 |
| 152 | danny | Feb_2021 |
second table is ss
| id | Jan_2021 | Feb_2021 |
|---|---|---|
| 151 | 2500 | 2200 |
| 152 | 1000 | 500 |
Mysql query iam using
SELECT
name,
id,
month,
( select SOD.month
from ss
where Empid=SOD.eid
) as ava
FROM
telephone as SOD
join ss
on SOD.id=ss.Emp_id
but i am not getting the exact result what i want . please help me to get this result from this tables
| id | name | month | ava |
|---|---|---|---|
| 151 | raj | Jan_2021 | 2500 |
| 152 | danny | Feb_2021 | 500 |