M
martinmike2
Hello:
I am running an update query to update a table with data from a higher
authority. My problem is that when I run the query it deletes any
newer data in my main table.
for example: I have a table called EDVR. This table gets updated
once a month by our higher authority and we run the update query to
reflect the changes. While the higher authority is keeping their
master copy of this table, we are making changes to ours. The EDVR
table contains data regarding our personnel's pay, position in the
company, specialties etc. etc. We get new personnel regularly that
are not reflected in the "Current" push from the higher authority, so
we have to add them to our EDVR table. When the next month rolls
around and we get the new push and run the update query, any personnel
not in the new push are deleted from our EDVR table. This is not good
as it results in having to re-input the data. This can take upwards
of a day, depending on the amount of data lost.
Here is the query:
UPDATE EDVR INNER JOIN EDVR1 ON EDVR.SSN = EDVR1.SSN1 SET EDVR.SPECAT
= EDVR1.SPECAT, EDVR.DESIG = EDVR1.DESIG, EDVR.LIM_DUTY =
EDVR1.LIM_DUTY, EDVR.NAME = EDVR1.NAME, EDVR.TAR_IND = EDVR1.TAR_IND,
EDVR.A_RATE_ABR = EDVR1.A_RATE_ABR, EDVR.SDAP = EDVR1.SDAP,
EDVR.D_RATE_ABR = EDVR1.D_RATE_ABR, EDVR.DNEC1 = EDVR1.DNEC1,
EDVR.DNEC2 = EDVR1.DNEC2, EDVR.SPI = EDVR1.SPI, EDVR.PNEC =
EDVR1.PNEC, EDVR.SNEC = EDVR1.SNEC, EDVR.CITIZ = EDVR1.CITIZ, EDVR.SEX
= EDVR1.SEX, EDVR.EREN = EDVR1.EREN, EDVR.EFM = EDVR1.EFM,
EDVR.PRI_DEP = EDVR1.PRI_DEP, EDVR.SEC_DEP = EDVR1.SEC_DEP, EDVR.DOS =
EDVR1.DOS, EDVR.ADSD = EDVR1.ADSD, EDVR.BR_CL = EDVR1.BR_CL, EDVR.EAOS
= EDVR1.EAOS, EDVR.SCOL_EXT = EDVR1.SCOL_EXT, EDVR.OTH_EXT =
EDVR1.OTH_EXT, EDVR.OPEX = EDVR1.OPEX, EDVR.PRD = EDVR1.PRD, EDVR.SDCD
= EDVR1.SDCD, EDVR.DATE_RECD = EDVR1.DATE_RECD, EDVR.ACCT_CAT =
EDVR1.ACCT_CAT, EDVR.EDA_EDL = EDVR1.EDA_EDL, EDVR.PG_PL_AUTH =
EDVR1.PG_PL_AUTH, EDVR.[SECTION] = EDVR1.SECTION, EDVR.DTY_STA_DT =
EDVR1.DTY_STA_DT, EDVR.UIC_TO_FRM = EDVR1.UIC_TO_FRM, EDVR.V_RMKS1 =
EDVR1.V_RMKS1, EDVR.V_RMKS2 = EDVR1.V_RMKS2, EDVR.V_RMKS3 =
EDVR1.V_RMKS3, EDVR.V_RMKS4 = EDVR1.V_RMKS4, EDVR.V_RMKS5 =
EDVR1.V_RMKS5, EDVR.A_RATE_CD = EDVR1.A_RATE_CD, EDVR.S_S = EDVR1.S_S,
EDVR.CMP = EDVR1.CMP, EDVR.MCA = EDVR1.MCA, EDVR.POB_START =
EDVR1.POB_START, EDVR.POB_STOP = EDVR1.POB_STOP, EDVR.POB_CAT3 =
EDVR1.POB_CAT3, EDVR.COB = EDVR1.COB, EDVR.TNEC = EDVR1.TNEC, EDVR.UIC
= EDVR1.UIC, EDVR.D_RATE_CD = EDVR1.D_RATE_CD, EDVR.A_FILLER1 =
EDVR1.A_FILLER1, EDVR.ARC = EDVR1.ARC, EDVR.ACT_SHT_TI =
EDVR1.ACT_SHT_TI, EDVR.QTNEC = EDVR1.QTNEC, EDVR.QNNEC = EDVR1.QNNEC,
EDVR.A_FILLER2 = EDVR1.A_FILLER2, EDVR.CW_UIC = EDVR1.CW_UIC,
EDVR.CW_SECT = EDVR1.CW_SECT, EDVR.CW_PART = EDVR1.CW_PART,
EDVR.A_FILLER3 = EDVR1.A_FILLER3, EDVR.TYPE_INVST = EDVR1.TYPE_INVST,
EDVR.INVEST_DT = EDVR1.INVEST_DT, EDVR.CLEAR_ELIG = EDVR1.CLEAR_ELIG,
EDVR.CLEAR_AUTH = EDVR1.CLEAR_AUTH, EDVR.GRANTED_DT =
EDVR1.GRANTED_DT, EDVR.INVOL_EXTS = EDVR1.INVOL_EXTS, EDVR.PEBD =
EDVR1.PEBD, EDVR.TIR = EDVR1.TIR, EDVR.ADV_EFF_DT = EDVR1.ADV_EFF_DT,
EDVR.FORMAN_STA = EDVR1.FORMAN_STA, EDVR.FORMAN_DT = EDVR1.FORMAN_DT,
EDVR.MIL_RANK = EDVR1.MIL_RANK, EDVR.WORK_CTR = EDVR1.WORK_CTR,
EDVR.STATUS = EDVR1.STATUS, EDVR.MOD_DATE = EDVR1.MOD_DATE,
EDVR.MODIFY = EDVR1.MODIFY, EDVR.FLAG = EDVR1.FLAG, EDVR.SSN =
EDVR1.SSN1;
Am I missing something? Is it as simple as a WHERE clause?
Any help would be appreciated
I am running an update query to update a table with data from a higher
authority. My problem is that when I run the query it deletes any
newer data in my main table.
for example: I have a table called EDVR. This table gets updated
once a month by our higher authority and we run the update query to
reflect the changes. While the higher authority is keeping their
master copy of this table, we are making changes to ours. The EDVR
table contains data regarding our personnel's pay, position in the
company, specialties etc. etc. We get new personnel regularly that
are not reflected in the "Current" push from the higher authority, so
we have to add them to our EDVR table. When the next month rolls
around and we get the new push and run the update query, any personnel
not in the new push are deleted from our EDVR table. This is not good
as it results in having to re-input the data. This can take upwards
of a day, depending on the amount of data lost.
Here is the query:
UPDATE EDVR INNER JOIN EDVR1 ON EDVR.SSN = EDVR1.SSN1 SET EDVR.SPECAT
= EDVR1.SPECAT, EDVR.DESIG = EDVR1.DESIG, EDVR.LIM_DUTY =
EDVR1.LIM_DUTY, EDVR.NAME = EDVR1.NAME, EDVR.TAR_IND = EDVR1.TAR_IND,
EDVR.A_RATE_ABR = EDVR1.A_RATE_ABR, EDVR.SDAP = EDVR1.SDAP,
EDVR.D_RATE_ABR = EDVR1.D_RATE_ABR, EDVR.DNEC1 = EDVR1.DNEC1,
EDVR.DNEC2 = EDVR1.DNEC2, EDVR.SPI = EDVR1.SPI, EDVR.PNEC =
EDVR1.PNEC, EDVR.SNEC = EDVR1.SNEC, EDVR.CITIZ = EDVR1.CITIZ, EDVR.SEX
= EDVR1.SEX, EDVR.EREN = EDVR1.EREN, EDVR.EFM = EDVR1.EFM,
EDVR.PRI_DEP = EDVR1.PRI_DEP, EDVR.SEC_DEP = EDVR1.SEC_DEP, EDVR.DOS =
EDVR1.DOS, EDVR.ADSD = EDVR1.ADSD, EDVR.BR_CL = EDVR1.BR_CL, EDVR.EAOS
= EDVR1.EAOS, EDVR.SCOL_EXT = EDVR1.SCOL_EXT, EDVR.OTH_EXT =
EDVR1.OTH_EXT, EDVR.OPEX = EDVR1.OPEX, EDVR.PRD = EDVR1.PRD, EDVR.SDCD
= EDVR1.SDCD, EDVR.DATE_RECD = EDVR1.DATE_RECD, EDVR.ACCT_CAT =
EDVR1.ACCT_CAT, EDVR.EDA_EDL = EDVR1.EDA_EDL, EDVR.PG_PL_AUTH =
EDVR1.PG_PL_AUTH, EDVR.[SECTION] = EDVR1.SECTION, EDVR.DTY_STA_DT =
EDVR1.DTY_STA_DT, EDVR.UIC_TO_FRM = EDVR1.UIC_TO_FRM, EDVR.V_RMKS1 =
EDVR1.V_RMKS1, EDVR.V_RMKS2 = EDVR1.V_RMKS2, EDVR.V_RMKS3 =
EDVR1.V_RMKS3, EDVR.V_RMKS4 = EDVR1.V_RMKS4, EDVR.V_RMKS5 =
EDVR1.V_RMKS5, EDVR.A_RATE_CD = EDVR1.A_RATE_CD, EDVR.S_S = EDVR1.S_S,
EDVR.CMP = EDVR1.CMP, EDVR.MCA = EDVR1.MCA, EDVR.POB_START =
EDVR1.POB_START, EDVR.POB_STOP = EDVR1.POB_STOP, EDVR.POB_CAT3 =
EDVR1.POB_CAT3, EDVR.COB = EDVR1.COB, EDVR.TNEC = EDVR1.TNEC, EDVR.UIC
= EDVR1.UIC, EDVR.D_RATE_CD = EDVR1.D_RATE_CD, EDVR.A_FILLER1 =
EDVR1.A_FILLER1, EDVR.ARC = EDVR1.ARC, EDVR.ACT_SHT_TI =
EDVR1.ACT_SHT_TI, EDVR.QTNEC = EDVR1.QTNEC, EDVR.QNNEC = EDVR1.QNNEC,
EDVR.A_FILLER2 = EDVR1.A_FILLER2, EDVR.CW_UIC = EDVR1.CW_UIC,
EDVR.CW_SECT = EDVR1.CW_SECT, EDVR.CW_PART = EDVR1.CW_PART,
EDVR.A_FILLER3 = EDVR1.A_FILLER3, EDVR.TYPE_INVST = EDVR1.TYPE_INVST,
EDVR.INVEST_DT = EDVR1.INVEST_DT, EDVR.CLEAR_ELIG = EDVR1.CLEAR_ELIG,
EDVR.CLEAR_AUTH = EDVR1.CLEAR_AUTH, EDVR.GRANTED_DT =
EDVR1.GRANTED_DT, EDVR.INVOL_EXTS = EDVR1.INVOL_EXTS, EDVR.PEBD =
EDVR1.PEBD, EDVR.TIR = EDVR1.TIR, EDVR.ADV_EFF_DT = EDVR1.ADV_EFF_DT,
EDVR.FORMAN_STA = EDVR1.FORMAN_STA, EDVR.FORMAN_DT = EDVR1.FORMAN_DT,
EDVR.MIL_RANK = EDVR1.MIL_RANK, EDVR.WORK_CTR = EDVR1.WORK_CTR,
EDVR.STATUS = EDVR1.STATUS, EDVR.MOD_DATE = EDVR1.MOD_DATE,
EDVR.MODIFY = EDVR1.MODIFY, EDVR.FLAG = EDVR1.FLAG, EDVR.SSN =
EDVR1.SSN1;
Am I missing something? Is it as simple as a WHERE clause?
Any help would be appreciated