I have two tables
id|columnA|columnB|columnC
x | a | b | c
and the second table:
id |id table1|columnD
z | x | 3
y | x | 10
I'm trying to get the max value from the second table and put it in the first table like this:
id|columnA|columnB|columnC|columnD
x | a | b | c |10
This is what I tried but it's not working
select id, columnA, columnB, columnC
, (select max(columnD) from table2 where table1.id = table2.idtable1),
from table1, table2
where table1.id = table2.idtable1
Any help?
table2from your outer query.