求一段sql写法 表1(成品,零件基础资料),字段:id,name,spec表2(bom):a_id(来自表1 id),b_id(来自表1 id)想要结果:a_id, name, spec, b_id, name, spec这个sql应如何写呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select a.id as a_id, name, spec, b_id, name, spec from a ,b where a.id = b.a_id select a_id,b.name,b.spec,b_id,c.name,c.specfrom bom aleft join table1 b on a.a_id = b.idleft join table1 c on a.b_id = c.id select a.id as a_id, name, spec, b_id, namefrom a ,b where a.id = b.a_id列名不能重复 select a_id, b.name, b.spec, b_id, c.name, c.spec from bom a left outer join table1 b on a.a_id = b.id left outer join table1 c on a.b_id = c.id select B.a_id,A.spec,B.b_id,A.name from 表1 A,bom B select a_id,b.name,b.spec,b_id,c.name,c.spec from bom a left join tb b on a.a_id = b.id left join tb c on a.b_id = c.id select a_id,[name],spec,b_id,[name],spec from bom,cplj这个就可以了。 这个不行,bom表1295条记录,但是出来的是几十万条,还没查询结束。 大家来讨论一下,索引一般设置在哪个字段上最好? 安全问题,有个疑问! 请高手指点 请问这个sql查询语句怎么写 遇错后,如何中止执行 如何设置vfp的combo1控件的默认项? 在线等待!急。 游标问题,在线等。。 快帮帮我,很急!!!我有一个xml格式的文件,需要导入到sqlserver2000中,怎么作呢? 如何查看本机上所有提供可用的"provider"? 在SYBASE中,MRU,LRU是什么意思? 加了distinct老是报错 从第 m 条到第 n 条记录的方法 不会用不懂...
from a ,b where a.id = b.a_id
from bom a
left join table1 b on a.a_id = b.id
left join table1 c on a.b_id = c.id
from a ,b where a.id = b.a_id列名不能重复
a_id,
b.name,
b.spec,
b_id,
c.name,
c.spec
from
bom a
left outer join
table1 b
on
a.a_id = b.id
left outer join
table1 c
on
a.b_id = c.id
a_id,b.name,b.spec,b_id,c.name,c.spec
from
bom a
left join
tb b on a.a_id = b.id
left join
tb c on a.b_id = c.id
这个不行,bom表1295条记录,但是出来的是几十万条,还没查询结束。