以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  表间查找  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=34667)

--  作者:lightmyfire
--  发布时间:2013/6/11 21:33:00
--  表间查找

想根据5-6个关联表,查出化验单的信息,用sql sever写出来是这样,

from [外部数据源].[dbo].[表1] as rec,
[外部数据源].[dbo].[表2] as br,
[外部数据源].[dbo].[表3] as xm,
[外部数据源].[dbo].[表4] as item,
[外部数据源].[dbo].[表5] as china,
[外部数据源].[dbo].[表6] as ywid
where br.name="宋伟"
and rec.blh=br.blh
and rec.ybh=xm.ybh
and rec.ybh=br.ybh
and rec.date=xm.jdate
and rec.sqdh=br.sqdh
and rec.itemid=item.hisid

and ietm.mid=xm.xm

我在窗口里从表1查出我需要的\'blh"和"date",现在根据这个查出来的"blh"和"date"怎么能实现从这么多表里汇总我要的这些字段的内容,用什么方法好实现,直接从窗口打开事件里写代码,这个对于我好像难道有点大,要是能写,应该怎么写啊