我可以在ms中添加子查询,例如:
select field1,field2,field3,
(select field4 from table2 where field5 = field3) from table1
我尝试了相同的操作,子查询为每一行带来了值。我只需要在field5 = field3
答案 0 :(得分:0)
根据您的意见,你可以试试这个
Select field1, field2,field3 + (select
IIF(IsNull(sum(field4)),0,sum(field4)) from table2 where table2field5 =
table2.fields3) from table1
尝试两个表之间的左连接
select table1.field1,table1.field2,table1.field3,table2.field4
from table1 left outer join table2 on
table1.field5= table2.field3
你可以尝试这样,我认为你正在尝试子查询,你正在尝试copare table1列到table2列
select field1,field2,field3,
(select field4 from table2 where table2. field5 = field3) from table1
或
select field1,field2,field3,
(select field4 from table2 where field5 = table2.field3) from table1