日期:2014-05-18  浏览次数:20503 次

关于联合记录查询的请教
A表
A1   A2
A     A

B表
B1   B2
B     B

查询结果是:
C表
C1   C2
A     A
B     B

小弟刚学,不懂,请朋友指教一下.

------解决方案--------------------
可以,不过可以简化一下

string strCmd = "select a.ip_id as ip_id , a.pname as pname,a.issuetime as issuetime ,b.username as username from T_IssueProduct as a,t_userinfo as b where a.userid = b.userid "
+ "union all "
+ "select b.pp_id as ip_id , b.pname as pname,b.issuetime as issuetime, c.username as username from T_ProductPrice as b ,t_userinfo as c where b.userid = c.userid "