以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]如何将两张表合并为一张表(已解决) (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=84767) |
-- 作者:yyzlxc -- 发布时间:2016/5/10 10:41:00 -- [求助]如何将两张表合并为一张表(已解决) 如何用Select语句,将TerminalID绑定ProcessNo合并到dt5表中,请各位老师指教,谢谢! Dim cmd1 As New SQLCommand Dim dt1 As DataTable cmd1.C cmd1.CommandText = "S elect TerminalID,ProcessNo F rom {TerminalState_ProcessList}" dt1 = cmd1.ExecuteReader() Dim cmd5 As New SQLCommand Dim dt5 As DataTable cmd5.C cmd5.CommandText = "S elect ProcessNo,StyleNo,EditionNo,SAM,NormalPrice1 F rom {Style}" dt5 = cmd5.ExecuteReader() [此贴子已经被作者于2016/5/10 11:12:39编辑过]
|
-- 作者:大红袍 -- 发布时间:2016/5/10 10:45:00 -- Dim cmd1 As New SQLCommand
Dim dt1 As DataTable
cmd1.CommandText = "S elect b.ProcessNo,b.StyleNo,b.EditionNo,b.SAM,b.NormalPrice1,a.TerminalID F rom {TerminalState_ProcessList} as a inner join {Style} as b on (a.ProcessNo = b.ProcessNo)"
dt1 = cmd1.ExecuteReader()
|
-- 作者:大红袍 -- 发布时间:2016/5/10 10:46:00 --
http://www.foxtable.com/help/topics/2473.htm
|
-- 作者:yyzlxc -- 发布时间:2016/5/10 11:12:00 -- 谢谢大红袍老师的指教,问题得到解决,再次衷心感谢!! |