Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 5 of 5 total |
Getting too many records |
Wed, Mar 25 2009 3:06 PM | Permanent Link |
Allan Brocklehurst | hello;
the following code gives me n times n records where I really only want to update the existing "n" records I have 3 and after this code I get 9 records. Any Suggestions on what I can do in SQL to do this. To get the job done I wrote code to loop thru the target table looking for existing DHA and Items UPDATE SAP_XREF_COMP SET [SAP_ZID] = [SAPITEMMASTER_20090114].[SAPMASTER IDENTIFIER], [SAP_ITEMNO] = [SAPITEMMASTER_20090114].[ITEMNO], [SAP_DHA] = [SAPITEMMASTER_20090114].[PLANT] FROM SAP_XREF_COMP JOIN "SAPITEMMASTER_20090114" ON [SAPITEMMASTER_20090114].[ITEMNO] = [SAP_XREF_COMP].[XREF_ITEMNO] AND SAPITEMMASTER_20090114].[PLANT] = [SAP_XREF_COMP].[XREF_DHA] TIA Allan |
Thu, Mar 26 2009 5:43 AM | Permanent Link |
"John Hay" | Allan
> the following code gives me n times n records where I really only want to update the existing "n" records > I have 3 and after this code I get 9 records. Any Suggestions on what I can do in SQL to do this. To get the job done I wrote code to loop thru the > target table looking for existing DHA and Items > > UPDATE SAP_XREF_COMP > SET > [SAP_ZID] = [SAPITEMMASTER_20090114].[SAPMASTER IDENTIFIER], > [SAP_ITEMNO] = [SAPITEMMASTER_20090114].[ITEMNO], > [SAP_DHA] = [SAPITEMMASTER_20090114].[PLANT] > FROM SAP_XREF_COMP > JOIN "SAPITEMMASTER_20090114" ON [SAPITEMMASTER_20090114].[ITEMNO] = [SAP_XREF_COMP].[XREF_ITEMNO] > AND SAPITEMMASTER_20090114].[PLANT] = [SAP_XREF_COMP].[XREF_DHA] Are you sure ? This code should not insert any records, only update existing ones. You also only need to update ZID as the other 2 fields must already be set correctly. John |
Thu, Mar 26 2009 8:37 AM | Permanent Link |
Allan Brocklehurst | John; I should have gone back to the SQL where I created the table BEFORE I wrote my plea in this ng. I created more records than I should of there. The Updates work as expected. Sorry for any problems. By the time I fixed this was at the end of 12 hours here and I was tired and a bit pissed Allan "John Hay" wrote: Allan > the following code gives me n times n records where I really only want to update the existing "n" records > I have 3 and after this code I get 9 records. Any Suggestions on what I can do in SQL to do this. To get the job done I wrote code to loop thru the > target table looking for existing DHA and Items > > UPDATE SAP_XREF_COMP > SET > [SAP_ZID] = [SAPITEMMASTER_20090114].[SAPMASTER IDENTIFIER], > [SAP_ITEMNO] = [SAPITEMMASTER_20090114].[ITEMNO], > [SAP_DHA] = [SAPITEMMASTER_20090114].[PLANT] > FROM SAP_XREF_COMP > JOIN "SAPITEMMASTER_20090114" ON [SAPITEMMASTER_20090114].[ITEMNO] = [SAP_XREF_COMP].[XREF_ITEMNO] > AND SAPITEMMASTER_20090114].[PLANT] = [SAP_XREF_COMP].[XREF_DHA] Are you sure ? This code should not insert any records, only update existing ones. You also only need to update ZID as the other 2 fields must already be set correctly. John |
Thu, Mar 26 2009 11:17 AM | Permanent Link |
"John Hay" | Allan
> Sorry for any problems. By the time I fixed this was at the end of 12 hours here and I was tired and a bit pissed Not pissed in the British sense I hope John |
Thu, Mar 26 2009 12:09 PM | Permanent Link |
Allan Brocklehurst | John;
Pissed in he British sense is the same as in the Canadian sense I really,really wanted to get pissed after yesterdays work was done. But, today is much of the same (i'm on a tight timeline). So, I have to settle for just being pissed off Allan "John Hay" wrote: Allan > Sorry for any problems. By the time I fixed this was at the end of 12 hours here and I was tired and a bit pissed Not pissed in the British sense I hope John |
This web page was last updated on Tuesday, May 7, 2024 at 06:25 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |