第一条:
select a.DPTNAME,I_E_PORT='7203',a.YDANCODE,a.I_E_DATE,a.SHIP_ID,a.BILL_NO,a.EXPNAME,a.TVALUE,a.EXPCNT,a.EDIWG,a.REXPMAN,TIME=GETDATE() FROM HaiGuan_SALOGISTEC_EHS..App_EMS_ExpInfo a left join HaiGuan_SALOGISTEC_EHS..App_ExpDNM b on a.BILL_NO = b.BILL_NO where a.ECMDCODE =1 and a.DEC_TYPE = '0' AND b.DEL_DATE IS NOT NULL and a.YDANCODE ='" + TEX_YDANCODE.Text + "'
第二条:
select a.DPTNAME,I_E_PORT='7203',a.YDANCODE,a.I_E_DATE,a.SHIP_ID,a.BILL_NO,c.EXPNAME,a.TVALUE,a.EXPCNT,a.EDIWG,a.REXPMAN,TIME=GETDATE() FROM HaiGuan_SALOGISTEC_EHS..App_EMS_ExpInfo a left join HaiGuan_SALOGISTEC_EHS..App_PrintTable c on a.BILL_NO = c.BILL_NO where a.YDANCODE='" + TEX_YDANCODE.Text + "'
查询的表:App_EMS_ExpInfo、App_ExpDNM、App_PrintTable
我是小白额,希望大哥大姐们能 指点下,非常感谢
我是用vs2010操作的数据库
select a.DPTNAME,
I_E_PORT = '7203',
a.YDANCODE,
a.I_E_DATE,
a.SHIP_ID,
a.BILL_NO,
a.EXPNAME,
a.TVALUE,
a.EXPCNT,
a.EDIWG,
a.REXPMAN,
TIME = GETDATE()
FROM HaiGuan_SALOGISTEC_EHS .. App_EMS_ExpInfo a
left join HaiGuan_SALOGISTEC_EHS .. App_ExpDNM b on a.BILL_NO = b.BILL_NO
left join HaiGuan_SALOGISTEC_EHS .. App_PrintTable c on a.BILL_NO = c.BILL_NO
where a.ECMDCODE = 1
and a.DEC_TYPE = '0'
AND b.DEL_DATE IS NOT NULL
and a.YDANCODE = '" + TEX_YDANCODE.Text + "'
这样行不行?你试一下
谢谢大哥,这就是我想要的
select a,b,c,d from tableA Union select a,b,c,d from tableB --去重
select a,b,c,d from tableA Union ALL select a,b,c,d from tableB --不去重
谢谢帮忙,可还是不清楚额,能说得明白点吗?谢谢了
@差不哆丨好先生: 什么地方不清楚
(select 语句) union (select 语句) union (select 语句) union (select 语句) union (select 语句)
哈哈 要的就是这个
有点不明白,你是想把三个表的结果显示到一个表里,还是三个表的结果显示到一条数据里。如果是前者,那么
select * from a left join b on a.bid=b.aid left join c on a.cid=c.aid就行,如果后者,要么是你打错字了,要么就是需求有问题。
如大哥所言,我确实是想把数据显示到app_ems_expinfo里面。谢谢大哥,先试下语句看看