• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Question on query

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends,

I've a table ORG_TABLE has columns CU_ID,ACC_ID,PORT_ID,SUPPORT_ID,REAS_NAME. I also have a table TEMP_TABLE having columns CU_ID,ACC_ID,PORT_ID,SUPPORT_ID. ORG_TABLE got about 45000 records and TEMP_TABLE has about 10000 records.

While all the columns for a row in TEMP_TABLE are not filled all the time.For example for one row CU_ID and PORT_ID having values.For another row CU_ID and SUPPORT_ID having values.It may also be like ACC_ID and PORT_ID having values and rest are null.So such combinations will exist in TEMP_TABLE.

I'm looking for single query which would be some thing like(considering first row values from TEMp_TABLE) UPDATE ORG_TABLE set ORG_TABLE.REAS_NAME=TEMP_TABLE.REAS_NAME where ORG_TABLE.CU_ID=TEMP_TABLE.CU_ID and ORG_TABLE.PORT_ID=TEMP_TABLE.PORT_ID.Similary the update should execute for the second combinations and so on for all the records in TEMP_TABLE.Dynamically query should be formed.

Thanks in advance



 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not sure I follow exactly when you want to do the update, but this sounds like
something you might want to do in a trigger when your temp table is updated
or an insert is done.
 
Without deviation from the norm, progress is not possible - Zappa. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic