select id,a,b,c,(select 1 from table2 where table2.id=table1.id)as d from table1
将table2中字段1的值显示在 查询结果中 类似
id, a,b,c,d
x, x ,x, x,table2内容
这个该怎么写呢
同样感谢
追答你的写法跟方向没有错,这里有个语法问题
select中的子查询,以及where中列=后面的子查询
必须返回唯一结果集,就是必须返回一个值
如果返回多个值就会报错,因为系统也没办法知道你究竟需要哪个值