select (select a2 from a table1 where table1.a1=b.b1) as b1, (select a2 from a table2 where table2.a1=b.b2) as b2,b3 from b 搞定!
select a.a2, c.a2, b3 from a, b, a c where b.b1 := a.a1 and b.b2 := c.a1
入库 selet a.a2, b.b1,b.b3 from a,b where a.a1=b.b2
select a.a2,b.* from a,b where a.a1=b.b1 我觉得你和出库表应该 改一下,怎么有出库和入库两个编码的,实在要的话这样 select a.a2,b.* from a,b where a.a1=b.b1 union select a.a2,b.* from a,b where a.a1=b.b2
select a.a2,b.* from a,b where a.a1=b.b1 and a.a1=b.b2
select a.a2,b.b3 from a,b where a.a1=b.b1 or a.a1=b.b2
对要分开做 出库 select a.a2,b.b3 from a,b where a.a1=b.b1 入库 select a.a2,b.b3 from a,b where a.a1=b.b2
select AC.a2,AR.a2,B.b3 from a AR,a AC,b B where AC.a1=B.b1 and AR.a1=B.b2 呵呵,应该是没有错误的!!!:)! 有问题发消息给我!
select aa.a2 from a aa,b bb where aa.a1=bb.b1
SELECT A.A2,B.B1,B.B2,B.B3 FROM A , B WHERE A.A1=B.B1或者SELECT * FROM B WHERE B1='????' 在用DBGRID显示的时候,使用LOOKUP字段,在关联一个查询SELECT * FROM A 关联关系A.A1=B.B1,显示A.A2。这样就可以了
(select a2 from a table2 where table2.a1=b.b2) as b2,b3 from b 搞定!
from a, b, a c
where b.b1 := a.a1
and b.b2 := c.a1
selet a.a2, b.b1,b.b3
from a,b
where a.a1=b.b2
我觉得你和出库表应该 改一下,怎么有出库和入库两个编码的,实在要的话这样
select a.a2,b.* from a,b where a.a1=b.b1 union
select a.a2,b.* from a,b where a.a1=b.b2
from a,b
where a.a1=b.b1 or a.a1=b.b2
出库
select a.a2,b.b3
from a,b
where a.a1=b.b1
入库
select a.a2,b.b3
from a,b
where a.a1=b.b2
呵呵,应该是没有错误的!!!:)!
有问题发消息给我!
在用DBGRID显示的时候,使用LOOKUP字段,在关联一个查询SELECT * FROM A
关联关系A.A1=B.B1,显示A.A2。这样就可以了