比如现在有a,b两个表,我想用b表的一个列的值去更新a表的一个列,因为b表的值可能有多个,我取第一个,SQL怎么写?update a set col = c.col from a, (select id , min(col) col from b group by id) c where a.id = c.id
update a set coli =c.coli from a,(select top 1 * from b where b.key = a.key)c where a.key = c.key
或update a set col = c.col from a, (select id , max(col) col from b group by id) c where a.id = c.id
set col = c.col
from a,
(select id , min(col) col from b group by id) c
where a.id = c.id
set col = c.col
from a,
(select id , max(col) col from b group by id) c
where a.id = c.id