sql 中一个表两个字段引用另一个表的同一字段字典代码,要显示出这两个字段对应的字典代码

2025-02-26 06:58:25
推荐回答(2个)
回答1:

容易理解的 select (select top 1 zdmc from 表2 where Zddm=zd1) as t1, (select top 1 zdmc from 表2 where Zddm=zd2) as t2 from 表1
推荐用楼上的联表查询,效率快

回答2:

select a.zdmc,b.zdmc from 表1,表2 a,表2 b where 表1.Zd1=a.Zddm and 表1.ZD2=b.Zddm