0

我正在尝试从 2 组联合表中进行嵌套连接。我不明白为什么会出现以下错误:

消息 156,级别 15,状态 1,第 15 行关键字“INNER”附近的语法不正确。消息 156,级别 15,状态 1,第 24 行关键字“开”附近的语法不正确。

我假设基于错误,我的 () 存在问题,但语法确实遵循Inner Join Operation中显示的语言。

这是代码:

SELECT TOP 1000

Pus.SerialnoId,Hus.RT,Hus.DIVISION,Hus.REGION,Hus.ADJHSG,Hus.ADJINC,Hus.WGTP,Hus.NP,Hus.TYPE,Hus.ACR,Hus.AGS,Hus.BLD,Hus.BUS,Hus.CONP,Hus.ELEP,Hus.FS,Hus.FULP,Hus.GASP,Hus.HFL,Hus.INSP,Hus.KIT,Hus.MHP,Hus.MRGI,Hus.MRGP,Hus.MRGT,Hus.MRGX,Hus.RNTM,Hus.RNTP,Hus.SMP,Hus.TEL,Hus.TEN,Hus.VACS,Hus.VEH,Hus.WATP,Hus.YBL,Hus.FES,Hus.FINCP,Hus.FPARC,Hus.GRNTP,Hus.GRPIP,Hus.HHL,Hus.HHT,Hus.HINCP,Hus.HUGCL,Hus.HUPAC,Hus.HUPAOC,Hus.HUPARC,Hus.LNGI,Hus.MV,Hus.NOC,Hus.NPF,Hus.NPP,Hus.NR,Hus.NRC,Hus.OCPIP,Hus.PARTNER,Hus.PSF,Hus.R18,Hus.R60,Hus.R65,Hus.RESMODE,Hus.SMOCP,Hus.SMX,Hus.SRNT,Hus.SVAL,Hus.TAXP,Hus.WIF,Hus.WKEXREL,Hus.WORKSTAT,Hus.FACRP,Hus.FAGSP,Hus.FBDSP,Hus.FBLDP,Hus.FBUSP,Hus.FCONP,Hus.FELEP,Hus.FFSP,Hus.FFULP,Hus.FGASP,Hus.FHFLP,Hus.FINSP,Hus.FKITP,Hus.FMHP,Hus.FMRGIP,Hus.FMRGP,Hus.FMRGTP,Hus.FMRGXP,Hus.FPLMP,Hus.FRMSP,Hus.FRNTMP,Hus.FRNTP,Hus.FSMP,Hus.FSMXHP,Hus.FSMXSP,Hus.FTA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TP77,Pus.PWGTP78,Pus.PWGTP79,Pus.PWGTP80

FROM 

    (select * FROM 
        (select serialnoId,RT,DIVISION,PUMA,REGION,ST,ADJHSG,ADJINC,WGTP,NP,TYPE,ACR,AGS,BLD,BUS,CONP,ELEP,FS,FULP,GASP,HFL,INSP,KIT,MHP,MRGI,MRGP,MRGT,MRGX,RNTM,RNTP,SMP,TEL,TEN,VACS,VEH,WATP,YBL,FES,FINCP,FPARC,GRNTP,GRPIP,HHL,HHT,HINCP,HUGCL,HUPAC,HUPAOC,HUPARC,LNGI,MV,NOC,NPF,NPP,NR,NRC,OCPIP,PARTNER,PSF,R18,R60,R65,RESMODE,SMOCP,SMX,SRNT,SVAL,TAXP,WIF,WKEXREL,WORKSTAT,FACRP,FAGSP,FBDSP,FBLDP,FBUSP,FCONP,FELEP,FFSP,FFULP,FGASP,FHFLP,FINSP,FKITP,FMHP,FMRGIP,FMRGP,FMRGTP,FMRGXP,FPLMP,FRMSP,FRNTMP,FRNTP,FSMP,FSMXHP,FSMXSP,FTAXP,FTELP,FTENP,FVACSP,FVALP,FVEHP,FWATP,FYBLP,WGTP1,WGTP2,WGTP3,WGTP4,WGTP5,WGTP6,WGTP7,WGTP8,WGTP9,WGTP10,WGTP11,WGTP12,WGTP13,WGTP14,WGTP15,WGTP16,WGTP17,WGTP18,WGTP19,WGTP20,WGTP21,WGTP22,WGTP23,WGTP24,WGTP25,WGTP26,WGTP27,WGTP28,WGTP29,WGTP30,WGTP31,WGTP32,WGTP33,WGTP34,WGTP35,WGTP36,WGTP37,WGTP38,WGTP39,WGTP40,WGTP41,WGTP42,WGTP43,WGTP44,WGTP45,WGTP46,WGTP47,WGTP48,WGTP49,WGTP50,WGTP51,WGTP52,WGTP53,WGTP54,WGTP55,WGTP56,WGTP57,WGTP58,WGTP59,WGTP60,WGTP61,WGTP62,WGTP63,WGTP64,WGTP65,WGTP66,WGTP67,WGTP68,WGTP69,WGTP70,WGTP71,WGTP72,WGTP73,WGTP74,WGTP75,WGTP76,WGTP77,WGTP78,WGTP79,WGTP80 from dbo.AcsBy320052007Hus
        UNION ALL 
        select serialnoId,RT,DIVISION,PUMA,REGION,ST,ADJHSG,ADJINC,WGTP,NP,TYPE,ACR,AGS,BLD,BUS,CONP,ELEP,FS,FULP,GASP,HFL,INSP,KIT,MHP,MRGI,MRGP,MRGT,MRGX,RNTM,RNTP,SMP,TEL,TEN,VACS,VEH,WATP,YBL,FES,FINCP,FPARC,GRNTP,GRPIP,HHL,HHT,HINCP,HUGCL,HUPAC,HUPAOC,HUPARC,LNGI,MV,NOC,NPF,NPP,NR,NRC,OCPIP,PARTNER,PSF,R18,R60,R65,RESMODE,SMOCP,SMX,SRNT,SVAL,TAXP,WIF,WKEXREL,WORKSTAT,FACRP,FAGSP,FBDSP,FBLDP,FBUSP,FCONP,FELEP,FFSP,FFULP,FGASP,FHFLP,FINSP,FKITP,FMHP,FMRGIP,FMRGP,FMRGTP,FMRGXP, FPLMP,FRMSP,FRNTMP,FRNTP,FSMP,FSMXHP,FSMXSP,FTAXP,FTELP,FTENP,FVACSP,FVALP,FVEHP,FWATP,FYBLP,WGTP1,WGTP2,WGTP3,WGTP4,WGTP5,WGTP6,WGTP7,WGTP8,WGTP9,WGTP10,WGTP11,WGTP12,WGTP13,WGTP14,WGTP15,WGTP16,WGTP17,WGTP18,WGTP19,WGTP20,WGTP21,WGTP22,WGTP23,WGTP24,WGTP25,WGTP26,WGTP27,WGTP28,WGTP29,WGTP30,WGTP31,WGTP32,WGTP33,WGTP34,WGTP35,WGTP36,WGTP37,WGTP38,WGTP39,WGTP40,WGTP41,WGTP42,WGTP43,WGTP44,WGTP45,WGTP46,WGTP47,WGTP48,WGTP49,WGTP50,WGTP51,WGTP52,WGTP53,WGTP54,WGTP55,WGTP56,WGTP57,WGTP58,WGTP59,WGTP60,WGTP61,WGTP62,WGTP63,WGTP64,WGTP65,WGTP66,WGTP67,WGTP68,WGTP69,WGTP70,WGTP71,WGTP72,WGTP73,WGTP74,WGTP75,WGTP76,WGTP77,WGTP78,WGTP79,WGTP80 from dbo.AcsBy320082010Hus 
        ) AS Hus
    )
    INNER JOIN 
    (select * FROM 
        (
        SELECT serialnoId,RT,SPORDER,PUMA,ST,ADJINC,PWGTP,AGEP,CIT,COW,DDRS,DEYE,DOUT,DPHY,DREM,ENG,FER,GCL,GCM,GCR,INTP,JWMNP,JWRIP,JWTR,LANX,MAR,MIG,MIL,MLPA,MLPB,MLPC,MLPD,MLPE,MLPF,MLPG,MLPH,MLPI,MLPJ,MLPK,NWAB,NWAV,NWLA,NWLK,NWRE,OIP,PAP,RETP,SCH,SCHG,SCHL,SEMP,SEX,SSIP,SSP,WAGP,WKHP,WKL,WKW,YOEP,ANC,ANC1P,ANC2P,DECADE,DRIVESP,ESP,ESR,HISP,INDP,JWAP,JWDP,LANP,MIGPUMA,MIGSP,MSP,NAICSP,NATIVITY,OC,PAOC,PERNP,PINCP,POBP,POVPIP,POWPUMA,POWSP,QTRBIR,RAC1P,RAC2P,RAC3P,RACAIAN,RACASN,RACBLK,RACNHPI,RACNUM,RACSOR,RACWHT,RC,SFN,SFR,VPS,WAOB,FAGEP,FANCP,FCITP,FCOWP,FDDRSP,FDEYEP,FDOUTP,FDPHYP,FDREMP,FENGP,FESRP,FFERP,FGCLP,FGCMP,FGCRP,FHISP,FINDP,FINTP,FJWDP,FJWMNP,FJWRIP,FJWTRP,FLANP,FLANXP,FMARP,FMIGP,FMIGSP,FMILPP,FMILSP,FOCCP,FOIP,FPAP,FPOBP,FPOWSP,FRACP,FRELP,FRETP,FSCHGP,FSCHLP,FSCHP,FSEMP,FSEXP,FSSIP,FSSP,FWAGP,FWKHP,FWKLP,FWKWP,FYOEP,PWGTP1,PWGTP2,PWGTP3,PWGTP4,PWGTP5,PWGTP6,PWGTP7,PWGTP8,PWGTP9,PWGTP10,PWGTP11,PWGTP12,PWGTP13,PWGTP14,PWGTP15,PWGTP16,PWGTP17,PWGTP18,PWGTP19,PWGTP20,PWGTP21,PWGTP22,PWGTP23,PWGTP24,PWGTP25,PWGTP26,PWGTP27,PWGTP28,PWGTP29,PWGTP30,PWGTP31,PWGTP32,PWGTP33,PWGTP34,PWGTP35,PWGTP36,PWGTP37,PWGTP38,PWGTP39,PWGTP40,PWGTP41,PWGTP42,PWGTP43,PWGTP44,PWGTP45,PWGTP46,PWGTP47,PWGTP48,PWGTP49,PWGTP50,PWGTP51,PWGTP52,PWGTP53,PWGTP54,PWGTP55,PWGTP56,PWGTP57,PWGTP58,PWGTP59,PWGTP60,PWGTP61,PWGTP62,PWGTP63,PWGTP64,PWGTP65,PWGTP66,PWGTP67,PWGTP68,PWGTP69,PWGTP70,PWGTP71,PWGTP72,PWGTP73,PWGTP74,PWGTP75,PWGTP76,PWGTP77,PWGTP78,PWGTP79,PWGTP80 FROM dbo.AcsBy320052007Pus
        UNION ALL 
        select serialnoId,RT,SPORDER,PUMA,ST,ADJINC,PWGTP,AGEP,CIT,COW,DDRS,DEYE,DOUT,DPHY,DREM,ENG,FER,GCL,GCM,GCR,INTP,JWMNP,JWRIP,JWTR,LANX,MAR,MIG,MIL,MLPA,MLPB,MLPC,MLPD,MLPE,MLPF,MLPG,MLPH,MLPI,MLPJ,MLPK,NWAB,NWAV,NWLA,NWLK,NWRE,OIP,PAP,RETP,SCH,SCHG,SCHL,SEMP,SEX,SSIP,SSP,WAGP,WKHP,WKL,WKW,YOEP,ANC,ANC1P,ANC2P,DECADE,DRIVESP,ESP,ESR,HISP,INDP,JWAP,JWDP,LANP,MIGPUMA,MIGSP,MSP,NAICSP,NATIVITY,OC,PAOC,PERNP,PINCP,POBP,POVPIP,POWPUMA,POWSP,QTRBIR,RAC1P,RAC2P,RAC3P,RACAIAN,RACASN,RACBLK,RACNHPI,RACNUM,RACSOR,RACWHT,RC,SFN,SFR,VPS,WAOB,FAGEP,FANCP,FCITP,FCOWP,FDDRSP,FDEYEP,FDOUTP,FDPHYP,FDREMP,FENGP,FESRP,FFERP,FGCLP,FGCMP,FGCRP,FHISP,FINDP,FINTP,FJWDP,FJWMNP,FJWRIP,FJWTRP,FLANP,FLANXP,FMARP,FMIGP,FMIGSP,FMILPP,FMILSP,FOCCP,FOIP,FPAP,FPOBP,FPOWSP,FRACP,FRELP,FRETP,FSCHGP,FSCHLP,FSCHP,FSEMP,FSEXP,FSSIP,FSSP,FWAGP,FWKHP,FWKLP,FWKWP,FYOEP,PWGTP1,PWGTP2,PWGTP3,PWGTP4,PWGTP5,PWGTP6,PWGTP7,PWGTP8,PWGTP9,PWGTP10,PWGTP11,PWGTP12,PWGTP13,PWGTP14,PWGTP15,PWGTP16,PWGTP17,PWGTP18,PWGTP19,PWGTP20,PWGTP21,PWGTP22,PWGTP23,PWGTP24,PWGTP25,PWGTP26,PWGTP27,PWGTP28,PWGTP29,PWGTP30,PWGTP31,PWGTP32,PWGTP33,PWGTP34,PWGTP35,PWGTP36,PWGTP37,PWGTP38,PWGTP39,PWGTP40,PWGTP41,PWGTP42,PWGTP43,PWGTP44,PWGTP45,PWGTP46,PWGTP47,PWGTP48,PWGTP49,PWGTP50,PWGTP51,PWGTP52,PWGTP53,PWGTP54,PWGTP55,PWGTP56,PWGTP57,PWGTP58,PWGTP59,PWGTP60,PWGTP61,PWGTP62,PWGTP63,PWGTP64,PWGTP65,PWGTP66,PWGTP67,PWGTP68,PWGTP69,PWGTP70,PWGTP71,PWGTP72,PWGTP73,PWGTP74,PWGTP75,PWGTP76,PWGTP77,PWGTP78,PWGTP79,PWGTP80 FROM dbo.AcsBy320082010Pus
        ) AS Pus
    )

On Hus.SerialNoId = Pus.SerialNoId
4

3 回答 3

1

我认为您不需要外部SELECT *陈述...尝试将您的更改FROM为以下内容:

FROM 
(
    SELECT serialnoId...
    FROM dbo.AcsBy320052007Hus

    UNION ALL 

    SELECT serialnoId...
    FROM dbo.AcsBy320082010Hus 
) AS Hus

    INNER JOIN 

(
    SELECT serialnoId... 
    FROM dbo.AcsBy320052007Pus

    UNION ALL 

    SELECT serialnoId...
    FROM dbo.AcsBy320082010Pus
) AS Pus

ON Hus.SerialNoId = Pus.SerialNoId
于 2012-11-08T21:58:28.293 回答
0

您是否尝试在子查询周围添加括号?

SELECT TOP 1000

Pus.SerialnoId,Hus.RT,Hus.DIVISION,Hus.REGION,Hus.ADJHSG,Hus.ADJINC,Hus.WGTP,Hus.NP,Hus.TYPE,Hus.ACR,Hus.AGS,Hus.BLD,Hus.BUS,Hus.CONP,Hus.ELEP,Hus.FS,Hus.FULP,Hus.GASP,Hus.HFL,Hus.INSP,Hus.KIT,Hus.MHP,Hus.MRGI,Hus.MRGP,Hus.MRGT,Hus.MRGX,Hus.RNTM,Hus.RNTP,Hus.SMP,Hus.TEL,Hus.TEN,Hus.VACS,Hus.VEH,Hus.WATP,Hus.YBL,Hus.FES,Hus.FINCP,Hus.FPARC,Hus.GRNTP,Hus.GRPIP,Hus.HHL,Hus.HHT,Hus.HINCP,Hus.HUGCL,Hus.HUPAC,Hus.HUPAOC,Hus.HUPARC,Hus.LNGI,Hus.MV,Hus.NOC,Hus.NPF,Hus.NPP,Hus.NR,Hus.NRC,Hus.OCPIP,Hus.PARTNER,Hus.PSF,Hus.R18,Hus.R60,Hus.R65,Hus.RESMODE,Hus.SMOCP,Hus.SMX,Hus.SRNT,Hus.SVAL,Hus.TAXP,Hus.WIF,Hus.WKEXREL,Hus.WORKSTAT,Hus.FACRP,Hus.FAGSP,Hus.FBDSP,Hus.FBLDP,Hus.FBUSP,Hus.FCONP,Hus.FELEP,Hus.FFSP,Hus.FFULP,Hus.FGASP,Hus.FHFLP,Hus.FINSP,Hus.FKITP,Hus.FMHP,Hus.FMRGIP,Hus.FMRGP,Hus.FMRGTP,Hus.FMRGXP,Hus.FPLMP,Hus.FRMSP,Hus.FRNTMP,Hus.FRNTP,Hus.FSMP,Hus.FSMXHP,Hus.FSMXSP,Hus.FTAXP,Hus.FTELP,Hus.FTENP,Hus.FVACSP,Hus.FVALP,Hus.FVEHP,Hus.FWATP,Hus.FYBLP,Hus.WGTP1,Hus.WGTP2,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P,Pus.FSEMP,Pus.FSEXP,Pus.FSSIP,Pus.FSSP,Pus.FWAGP,Pus.FWKHP,Pus.FWKLP,Pus.FWKWP,Pus.FYOEP,Pus.PWGTP1,Pus.PWGTP2,Pus.PWGTP3,Pus.PWGTP4,Pus.PWGTP5,Pus.PWGTP6,Pus.PWGTP7,Pus.PWGTP8,Pus.PWGTP9,Pus.PWGTP10,Pus.PWGTP11,Pus.PWGTP12,Pus.PWGTP13,Pus.PWGTP14,Pus.PWGTP15,Pus.PWGTP16,Pus.PWGTP17,Pus.PWGTP18,Pus.PWGTP19,Pus.PWGTP20,Pus.PWGTP21,Pus.PWGTP22,Pus.PWGTP23,Pus.PWGTP24,Pus.PWGTP25,Pus.PWGTP26,Pus.PWGTP27,Pus.PWGTP28,Pus.PWGTP29,Pus.PWGTP30,Pus.PWGTP31,Pus.PWGTP32,Pus.PWGTP33,Pus.PWGTP34,Pus.PWGTP35,Pus.PWGTP36,Pus.PWGTP37,Pus.PWGTP38,Pus.PWGTP39,Pus.PWGTP40,Pus.PWGTP41,Pus.PWGTP42,Pus.PWGTP43,Pus.PWGTP44,Pus.PWGTP45,Pus.PWGTP46,Pus.PWGTP47,Pus.PWGTP48,Pus.PWGTP49,Pus.PWGTP50,Pus.PWGTP51,Pus.PWGTP52,Pus.PWGTP53,Pus.PWGTP54,Pus.PWGTP55,Pus.PWGTP56,Pus.PWGTP57,Pus.PWGTP58,Pus.PWGTP59,Pus.PWGTP60,Pus.PWGTP61,Pus.PWGTP62,Pus.PWGTP63,Pus.PWGTP64,Pus.PWGTP65,Pus.PWGTP66,Pus.PWGTP67,Pus.PWGTP68,Pus.PWGTP69,Pus.PWGTP70,Pus.PWGTP71,Pus.PWGTP72,Pus.PWGTP73,Pus.PWGTP74,Pus.PWGTP75,Pus.PWGTP76,Pus.PWGTP77,Pus.PWGTP78,Pus.PWGTP79,Pus.PWGTP80

FROM 
(
    (select * FROM 
        (select serialnoId,RT,DIVISION,PUMA,REGION,ST,ADJHSG,ADJINC,WGTP,NP,TYPE,ACR,AGS,BLD,BUS,CONP,ELEP,FS,FULP,GASP,HFL,INSP,KIT,MHP,MRGI,MRGP,MRGT,MRGX,RNTM,RNTP,SMP,TEL,TEN,VACS,VEH,WATP,YBL,FES,FINCP,FPARC,GRNTP,GRPIP,HHL,HHT,HINCP,HUGCL,HUPAC,HUPAOC,HUPARC,LNGI,MV,NOC,NPF,NPP,NR,NRC,OCPIP,PARTNER,PSF,R18,R60,R65,RESMODE,SMOCP,SMX,SRNT,SVAL,TAXP,WIF,WKEXREL,WORKSTAT,FACRP,FAGSP,FBDSP,FBLDP,FBUSP,FCONP,FELEP,FFSP,FFULP,FGASP,FHFLP,FINSP,FKITP,FMHP,FMRGIP,FMRGP,FMRGTP,FMRGXP,FPLMP,FRMSP,FRNTMP,FRNTP,FSMP,FSMXHP,FSMXSP,FTAXP,FTELP,FTENP,FVACSP,FVALP,FVEHP,FWATP,FYBLP,WGTP1,WGTP2,WGTP3,WGTP4,WGTP5,WGTP6,WGTP7,WGTP8,WGTP9,WGTP10,WGTP11,WGTP12,WGTP13,WGTP14,WGTP15,WGTP16,WGTP17,WGTP18,WGTP19,WGTP20,WGTP21,WGTP22,WGTP23,WGTP24,WGTP25,WGTP26,WGTP27,WGTP28,WGTP29,WGTP30,WGTP31,WGTP32,WGTP33,WGTP34,WGTP35,WGTP36,WGTP37,WGTP38,WGTP39,WGTP40,WGTP41,WGTP42,WGTP43,WGTP44,WGTP45,WGTP46,WGTP47,WGTP48,WGTP49,WGTP50,WGTP51,WGTP52,WGTP53,WGTP54,WGTP55,WGTP56,WGTP57,WGTP58,WGTP59,WGTP60,WGTP61,WGTP62,WGTP63,WGTP64,WGTP65,WGTP66,WGTP67,WGTP68,WGTP69,WGTP70,WGTP71,WGTP72,WGTP73,WGTP74,WGTP75,WGTP76,WGTP77,WGTP78,WGTP79,WGTP80 from dbo.AcsBy320052007Hus
        UNION ALL 
        select serialnoId,RT,DIVISION,PUMA,REGION,ST,ADJHSG,ADJINC,WGTP,NP,TYPE,ACR,AGS,BLD,BUS,CONP,ELEP,FS,FULP,GASP,HFL,INSP,KIT,MHP,MRGI,MRGP,MRGT,MRGX,RNTM,RNTP,SMP,TEL,TEN,VACS,VEH,WATP,YBL,FES,FINCP,FPARC,GRNTP,GRPIP,HHL,HHT,HINCP,HUGCL,HUPAC,HUPAOC,HUPARC,LNGI,MV,NOC,NPF,NPP,NR,NRC,OCPIP,PARTNER,PSF,R18,R60,R65,RESMODE,SMOCP,SMX,SRNT,SVAL,TAXP,WIF,WKEXREL,WORKSTAT,FACRP,FAGSP,FBDSP,FBLDP,FBUSP,FCONP,FELEP,FFSP,FFULP,FGASP,FHFLP,FINSP,FKITP,FMHP,FMRGIP,FMRGP,FMRGTP,FMRGXP, FPLMP,FRMSP,FRNTMP,FRNTP,FSMP,FSMXHP,FSMXSP,FTAXP,FTELP,FTENP,FVACSP,FVALP,FVEHP,FWATP,FYBLP,WGTP1,WGTP2,WGTP3,WGTP4,WGTP5,WGTP6,WGTP7,WGTP8,WGTP9,WGTP10,WGTP11,WGTP12,WGTP13,WGTP14,WGTP15,WGTP16,WGTP17,WGTP18,WGTP19,WGTP20,WGTP21,WGTP22,WGTP23,WGTP24,WGTP25,WGTP26,WGTP27,WGTP28,WGTP29,WGTP30,WGTP31,WGTP32,WGTP33,WGTP34,WGTP35,WGTP36,WGTP37,WGTP38,WGTP39,WGTP40,WGTP41,WGTP42,WGTP43,WGTP44,WGTP45,WGTP46,WGTP47,WGTP48,WGTP49,WGTP50,WGTP51,WGTP52,WGTP53,WGTP54,WGTP55,WGTP56,WGTP57,WGTP58,WGTP59,WGTP60,WGTP61,WGTP62,WGTP63,WGTP64,WGTP65,WGTP66,WGTP67,WGTP68,WGTP69,WGTP70,WGTP71,WGTP72,WGTP73,WGTP74,WGTP75,WGTP76,WGTP77,WGTP78,WGTP79,WGTP80 from dbo.AcsBy320082010Hus 
        ) AS Hus
    )
    INNER JOIN 
    (select * FROM 
        (
        SELECT ser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,PWGTP36,PWGTP37,PWGTP38,PWGTP39,PWGTP40,PWGTP41,PWGTP42,PWGTP43,PWGTP44,PWGTP45,PWGTP46,PWGTP47,PWGTP48,PWGTP49,PWGTP50,PWGTP51,PWGTP52,PWGTP53,PWGTP54,PWGTP55,PWGTP56,PWGTP57,PWGTP58,PWGTP59,PWGTP60,PWGTP61,PWGTP62,PWGTP63,PWGTP64,PWGTP65,PWGTP66,PWGTP67,PWGTP68,PWGTP69,PWGTP70,PWGTP71,PWGTP72,PWGTP73,PWGTP74,PWGTP75,PWGTP76,PWGTP77,PWGTP78,PWGTP79,PWGTP80 FROM dbo.AcsBy320052007Pus
        UNION ALL 
        select serialnoId,RT,SPORDER,PUMA,ST,ADJINC,PWGTP,AGEP,CIT,COW,DDRS,DEYE,DOUT,DPHY,DREM,ENG,FER,GCL,GCM,GCR,INTP,JWMNP,JWRIP,JWTR,LANX,MAR,MIG,MIL,MLPA,MLPB,MLPC,MLPD,MLPE,MLPF,MLPG,MLPH,MLPI,MLPJ,MLPK,NWAB,NWAV,NWLA,NWLK,NWRE,OIP,PAP,RETP,SCH,SCHG,SCHL,SEMP,SEX,SSIP,SSP,WAGP,WKHP,WKL,WKW,YOEP,ANC,ANC1P,ANC2P,DECADE,DRIVESP,ESP,ESR,HISP,INDP,JWAP,JWDP,LANP,MIGPUMA,MIGSP,MSP,NAICSP,NATIVITY,OC,PAOC,PERNP,PINCP,POBP,POVPIP,POWPUMA,POWSP,QTRBIR,RAC1P,RAC2P,RAC3P,RACAIAN,RACASN,RACBLK,RACNHPI,RACNUM,RACSOR,RACWHT,RC,SFN,SFR,VPS,WAOB,FAGEP,FANCP,FCITP,FCOWP,FDDRSP,FDEYEP,FDOUTP,FDPHYP,FDREMP,FENGP,FESRP,FFERP,FGCLP,FGCMP,FGCRP,FHISP,FINDP,FINTP,FJWDP,FJWMNP,FJWRIP,FJWTRP,FLANP,FLANXP,FMARP,FMIGP,FMIGSP,FMILPP,FMILSP,FOCCP,FOIP,FPAP,FPOBP,FPOWSP,FRACP,FRELP,FRETP,FSCHGP,FSCHLP,FSCHP,FSEMP,FSEXP,FSSIP,FSSP,FWAGP,FWKHP,FWKLP,FWKWP,FYOEP,PWGTP1,PWGTP2,PWGTP3,PWGTP4,PWGTP5,PWGTP6,PWGTP7,PWGTP8,PWGTP9,PWGTP10,PWGTP11,PWGTP12,PWGTP13,PWGTP14,PWGTP15,PWGTP16,PWGTP17,PWGTP18,PWGTP19,PWGTP20,PWGTP21,PWGTP22,PWGTP23,PWGTP24,PWGTP25,PWGTP26,PWGTP27,PWGTP28,PWGTP29,PWGTP30,PWGTP31,PWGTP32,PWGTP33,PWGTP34,PWGTP35,PWGTP36,PWGTP37,PWGTP38,PWGTP39,PWGTP40,PWGTP41,PWGTP42,PWGTP43,PWGTP44,PWGTP45,PWGTP46,PWGTP47,PWGTP48,PWGTP49,PWGTP50,PWGTP51,PWGTP52,PWGTP53,PWGTP54,PWGTP55,PWGTP56,PWGTP57,PWGTP58,PWGTP59,PWGTP60,PWGTP61,PWGTP62,PWGTP63,PWGTP64,PWGTP65,PWGTP66,PWGTP67,PWGTP68,PWGTP69,PWGTP70,PWGTP71,PWGTP72,PWGTP73,PWGTP74,PWGTP75,PWGTP76,PWGTP77,PWGTP78,PWGTP79,PWGTP80 FROM dbo.AcsBy320082010Pus
        ) AS Pus
    )
) myData
On Hus.SerialNoId = Pus.SerialNoId
于 2012-11-08T21:55:19.560 回答
0

您将表别名放在错误的位置,请尝试:

SELECT TOP 1000

Pus.SerialnoId,Hus.RT,Hus.DIVISION,Hus.REGION,Hus.ADJHSG,Hus.ADJINC,Hus.WGTP,Hus.NP,Hus.TYPE,Hus.ACR,Hus.AGS,Hus.BLD,Hus.BUS,Hus.CONP,Hus.ELEP,Hus.FS,Hus.FULP,Hus.GASP,Hus.HFL,Hus.INSP,Hus.KIT,Hus.MHP,Hus.MRGI,Hus.MRGP,Hus.MRGT,Hus.MRGX,Hus.RNTM,Hus.RNTP,Hus.SMP,Hus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us.PWGTP23,Pus.PWGTP24,Pus.PWGTP25,Pus.PWGTP26,Pus.PWGTP27,Pus.PWGTP28,Pus.PWGTP29,Pus.PWGTP30,Pus.PWGTP31,Pus.PWGTP32,Pus.PWGTP33,Pus.PWGTP34,Pus.PWGTP35,Pus.PWGTP36,Pus.PWGTP37,Pus.PWGTP38,Pus.PWGTP39,Pus.PWGTP40,Pus.PWGTP41,Pus.PWGTP42,Pus.PWGTP43,Pus.PWGTP44,Pus.PWGTP45,Pus.PWGTP46,Pus.PWGTP47,Pus.PWGTP48,Pus.PWGTP49,Pus.PWGTP50,Pus.PWGTP51,Pus.PWGTP52,Pus.PWGTP53,Pus.PWGTP54,Pus.PWGTP55,Pus.PWGTP56,Pus.PWGTP57,Pus.PWGTP58,Pus.PWGTP59,Pus.PWGTP60,Pus.PWGTP61,Pus.PWGTP62,Pus.PWGTP63,Pus.PWGTP64,Pus.PWGTP65,Pus.PWGTP66,Pus.PWGTP67,Pus.PWGTP68,Pus.PWGTP69,Pus.PWGTP70,Pus.PWGTP71,Pus.PWGTP72,Pus.PWGTP73,Pus.PWGTP74,Pus.PWGTP75,Pus.PWGTP76,Pus.PWGTP77,Pus.PWGTP78,Pus.PWGTP79,Pus.PWGTP80

FROM 

    (select * FROM 
        (select serialnoId,RT,DIVISION,PUMA,REGION,ST,ADJHSG,ADJINC,WGTP,NP,TYPE,ACR,AGS,BLD,BUS,CONP,ELEP,FS,FULP,GASP,HFL,INSP,KIT,MHP,MRGI,MRGP,MRGT,MRGX,RNTM,RNTP,SMP,TEL,TEN,VACS,VEH,WATP,YBL,FES,FINCP,FPARC,GRNTP,GRPIP,HHL,HHT,HINCP,HUGCL,HUPAC,HUPAOC,HUPARC,LNGI,MV,NOC,NPF,NPP,NR,NRC,OCPIP,PARTNER,PSF,R18,R60,R65,RESMODE,SMOCP,SMX,SRNT,SVAL,TAXP,WIF,WKEXREL,WORKSTAT,FACRP,FAGSP,FBDSP,FBLDP,FBUSP,FCONP,FELEP,FFSP,FFULP,FGASP,FHFLP,FINSP,FKITP,FMHP,FMRGIP,FMRGP,FMRGTP,FMRGXP,FPLMP,FRMSP,FRNTMP,FRNTP,FSMP,FSMXHP,FSMXSP,FTAXP,FTELP,FTENP,FVACSP,FVALP,FVEHP,FWATP,FYBLP,WGTP1,WGTP2,WGTP3,WGTP4,WGTP5,WGTP6,WGTP7,WGTP8,WGTP9,WGTP10,WGTP11,WGTP12,WGTP13,WGTP14,WGTP15,WGTP16,WGTP17,WGTP18,WGTP19,WGTP20,WGTP21,WGTP22,WGTP23,WGTP24,WGTP25,WGTP26,WGTP27,WGTP28,WGTP29,WGTP30,WGTP31,WGTP32,WGTP33,WGTP34,WGTP35,WGTP36,WGTP37,WGTP38,WGTP39,WGTP40,WGTP41,WGTP42,WGTP43,WGTP44,WGTP45,WGTP46,WGTP47,WGTP48,WGTP49,WGTP50,WGTP51,WGTP52,WGTP53,WGTP54,WGTP55,WGTP56,WGTP57,WGTP58,WGTP59,WGTP60,WGTP61,WGTP62,WGTP63,WGTP64,WGTP65,WGTP66,WGTP67,WGTP68,WGTP69,WGTP70,WGTP71,WGTP72,WGTP73,WGTP74,WGTP75,WGTP76,WGTP77,WGTP78,WGTP79,WGTP80 from dbo.AcsBy320052007Hus
        UNION ALL 
        select serialnoId,RT,DIVISION,PUMA,REGION,ST,ADJHSG,ADJINC,WGTP,NP,TYPE,ACR,AGS,BLD,BUS,CONP,ELEP,FS,FULP,GASP,HFL,INSP,KIT,MHP,MRGI,MRGP,MRGT,MRGX,RNTM,RNTP,SMP,TEL,TEN,VACS,VEH,WATP,YBL,FES,FINCP,FPARC,GRNTP,GRPIP,HHL,HHT,HINCP,HUGCL,HUPAC,HUPAOC,HUPARC,LNGI,MV,NOC,NPF,NPP,NR,NRC,OCPIP,PARTNER,PSF,R18,R60,R65,RESMODE,SMOCP,SMX,SRNT,SVAL,TAXP,WIF,WKEXREL,WORKSTAT,FACRP,FAGSP,FBDSP,FBLDP,FBUSP,FCONP,FELEP,FFSP,FFULP,FGASP,FHFLP,FINSP,FKITP,FMHP,FMRGIP,FMRGP,FMRGTP,FMRGXP, FPLMP,FRMSP,FRNTMP,FRNTP,FSMP,FSMXHP,FSMXSP,FTAXP,FTELP,FTENP,FVACSP,FVALP,FVEHP,FWATP,FYBLP,WGTP1,WGTP2,WGTP3,WGTP4,WGTP5,WGTP6,WGTP7,WGTP8,WGTP9,WGTP10,WGTP11,WGTP12,WGTP13,WGTP14,WGTP15,WGTP16,WGTP17,WGTP18,WGTP19,WGTP20,WGTP21,WGTP22,WGTP23,WGTP24,WGTP25,WGTP26,WGTP27,WGTP28,WGTP29,WGTP30,WGTP31,WGTP32,WGTP33,WGTP34,WGTP35,WGTP36,WGTP37,WGTP38,WGTP39,WGTP40,WGTP41,WGTP42,WGTP43,WGTP44,WGTP45,WGTP46,WGTP47,WGTP48,WGTP49,WGTP50,WGTP51,WGTP52,WGTP53,WGTP54,WGTP55,WGTP56,WGTP57,WGTP58,WGTP59,WGTP60,WGTP61,WGTP62,WGTP63,WGTP64,WGTP65,WGTP66,WGTP67,WGTP68,WGTP69,WGTP70,WGTP71,WGTP72,WGTP73,WGTP74,WGTP75,WGTP76,WGTP77,WGTP78,WGTP79,WGTP80 from dbo.AcsBy320082010Hus 
        )
    ) AS Hus
    INNER JOIN 
    (select * FROM 
        (
        SELECT serialnoId,RT,SPORDER,PUMA,ST,ADJINC,PWGTP,AGEP,CIT,COW,DDRS,DEYE,DOUT,DPHY,DREM,ENG,FER,GCL,GCM,GCR,INTP,JWMNP,JWRIP,JWTR,LANX,MAR,MIG,MIL,MLPA,MLPB,MLPC,MLPD,MLPE,MLPF,MLPG,MLPH,MLPI,MLPJ,MLPK,NWAB,NWAV,NWLA,NWLK,NWRE,OIP,PAP,RETP,SCH,SCHG,SCHL,SEMP,SEX,SSIP,SSP,WAGP,WKHP,WKL,WKW,YOEP,ANC,ANC1P,ANC2P,DECADE,DRIVESP,ESP,ESR,HISP,INDP,JWAP,JWDP,LANP,MIGPUMA,MIGSP,MSP,NAICSP,NATIVITY,OC,PAOC,PERNP,PINCP,POBP,POVPIP,POWPUMA,POWSP,QTRBIR,RAC1P,RAC2P,RAC3P,RACAIAN,RACASN,RACBLK,RACNHPI,RACNUM,RACSOR,RACWHT,RC,SFN,SFR,VPS,WAOB,FAGEP,FANCP,FCITP,FCOWP,FDDRSP,FDEYEP,FDOUTP,FDPHYP,FDREMP,FENGP,FESRP,FFERP,FGCLP,FGCMP,FGCRP,FHISP,FINDP,FINTP,FJWDP,FJWMNP,FJWRIP,FJWTRP,FLANP,FLANXP,FMARP,FMIGP,FMIGSP,FMILPP,FMILSP,FOCCP,FOIP,FPAP,FPOBP,FPOWSP,FRACP,FRELP,FRETP,FSCHGP,FSCHLP,FSCHP,FSEMP,FSEXP,FSSIP,FSSP,FWAGP,FWKHP,FWKLP,FWKWP,FYOEP,PWGTP1,PWGTP2,PWGTP3,PWGTP4,PWGTP5,PWGTP6,PWGTP7,PWGTP8,PWGTP9,PWGTP10,PWGTP11,PWGTP12,PWGTP13,PWGTP14,PWGTP15,PWGTP16,PWGTP17,PWGTP18,PWGTP19,PWGTP20,PWGTP21,PWGTP22,PWGTP23,PWGTP24,PWGTP25,PWGTP26,PWGTP27,PWGTP28,PWGTP29,PWGTP30,PWGTP31,PWGTP32,PWGTP33,PWGTP34,PWGTP35,PWGTP36,PWGTP37,PWGTP38,PWGTP39,PWGTP40,PWGTP41,PWGTP42,PWGTP43,PWGTP44,PWGTP45,PWGTP46,PWGTP47,PWGTP48,PWGTP49,PWGTP50,PWGTP51,PWGTP52,PWGTP53,PWGTP54,PWGTP55,PWGTP56,PWGTP57,PWGTP58,PWGTP59,PWGTP60,PWGTP61,PWGTP62,PWGTP63,PWGTP64,PWGTP65,PWGTP66,PWGTP67,PWGTP68,PWGTP69,PWGTP70,PWGTP71,PWGTP72,PWGTP73,PWGTP74,PWGTP75,PWGTP76,PWGTP77,PWGTP78,PWGTP79,PWGTP80 FROM dbo.AcsBy320052007Pus
        U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TP34,PWGTP35,PWGTP36,PWGTP37,PWGTP38,PWGTP39,PWGTP40,PWGTP41,PWGTP42,PWGTP43,PWGTP44,PWGTP45,PWGTP46,PWGTP47,PWGTP48,PWGTP49,PWGTP50,PWGTP51,PWGTP52,PWGTP53,PWGTP54,PWGTP55,PWGTP56,PWGTP57,PWGTP58,PWGTP59,PWGTP60,PWGTP61,PWGTP62,PWGTP63,PWGTP64,PWGTP65,PWGTP66,PWGTP67,PWGTP68,PWGTP69,PWGTP70,PWGTP71,PWGTP72,PWGTP73,PWGTP74,PWGTP75,PWGTP76,PWGTP77,PWGTP78,PWGTP79,PWGTP80 FROM dbo.AcsBy320082010Pus
        )
    ) AS Pus

On Hus.SerialNoId = Pus.SerialNoId
于 2012-11-08T22:00:06.657 回答