select table1.*,
(select path
from table2 t2
where t2.id=
(select min(id) from table2 t3 where t3.code=table1.picpath)
)
from table1
(select path
from table2 t2
where t2.id=
(select min(id) from table2 t3 where t3.code=table1.picpath)
)
from table1
(select top 1 path from table2 where code = A.picpath order by id) as path
from table1 as A
在这一子查询或聚合表达式中,text、ntext 和 image 数据类型无效。
from table1 a left join (
select code,min(path) as path from table2 group by code
) as b
on a.picpath=b.code