SQL查询结果合并到一个表
selectkeycode,房屋坐落,产权面积,所有权证号,所有权人,Convert(varchar,收件日期,23)fromfilesinwherekeycodein(...
select keycode,房屋坐落,产权面积,所有权证号,所有权人,Convert(varchar,收件日期,23) from filesin where keycode in (SELECT keycode FROM zlink WHERE Convert(varchar,gddate,120)between '20130701'and '20130731'and regtype like '%商品%')
select keycode,rvalue,Convert(varchar,gddate,23) from zlink where keycode in (SELECT keycode FROM zlink WHERE Convert(varchar,gddate,120)between '20130701'and '20130731'and regtype like '%商品%')
select keycode,tel from zperson where keycode in (SELECT keycode FROM zlink WHERE Convert(varchar,gddate,120)between '20130701'and '20130731'and regtype like '%商品%')
将这3个查询结果合并到一个表(按keycode字段)里,高手们帮帮忙吧 展开
select keycode,rvalue,Convert(varchar,gddate,23) from zlink where keycode in (SELECT keycode FROM zlink WHERE Convert(varchar,gddate,120)between '20130701'and '20130731'and regtype like '%商品%')
select keycode,tel from zperson where keycode in (SELECT keycode FROM zlink WHERE Convert(varchar,gddate,120)between '20130701'and '20130731'and regtype like '%商品%')
将这3个查询结果合并到一个表(按keycode字段)里,高手们帮帮忙吧 展开
展开全部
Select X.*,y.*,z.* From
(select keycode,房屋坐落,产权面积,所有权证号,所有权人,Convert(varchar,收件日期,23) from filesin where keycode in (SELECT keycode FROM zlink WHERE Convert(varchar,gddate,120)between '20130701'and '20130731'and regtype like '%商品%')) X,
(select keycode,rvalue,Convert(varchar,gddate,23) from zlink where keycode in (SELECT keycode FROM zlink WHERE Convert(varchar,gddate,120)between '20130701'and '20130731'and regtype like '%商品%')) Y,
(select keycode,tel from zperson where keycode in (SELECT keycode FROM zlink WHERE Convert(varchar,gddate,120)between '20130701'and '20130731'and regtype like '%商品%') Z
Where X.KeyCode = Y.KeyCode and Y.KeyCode = Z.KeyCode
以上是字段全累加。如不需要可以在第一句中一一标注如:select x.KeyCode,y.rvalue,z.tel From x,y,z ....................................
(select keycode,房屋坐落,产权面积,所有权证号,所有权人,Convert(varchar,收件日期,23) from filesin where keycode in (SELECT keycode FROM zlink WHERE Convert(varchar,gddate,120)between '20130701'and '20130731'and regtype like '%商品%')) X,
(select keycode,rvalue,Convert(varchar,gddate,23) from zlink where keycode in (SELECT keycode FROM zlink WHERE Convert(varchar,gddate,120)between '20130701'and '20130731'and regtype like '%商品%')) Y,
(select keycode,tel from zperson where keycode in (SELECT keycode FROM zlink WHERE Convert(varchar,gddate,120)between '20130701'and '20130731'and regtype like '%商品%') Z
Where X.KeyCode = Y.KeyCode and Y.KeyCode = Z.KeyCode
以上是字段全累加。如不需要可以在第一句中一一标注如:select x.KeyCode,y.rvalue,z.tel From x,y,z ....................................
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询