473,382 Members | 1,329 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

how to update a value in other table

1
Hi guys.... suggestions needed

I have the following tables

Table : Temp3
--------------------------
Temp3ID Char1 Char2
1 x1 NULL
2 x1 312
3 x2 420
4 x2 NULL
5 x3 NULL
6 x3 889


Table : matter
------------------------
MatterID Temp3ID
900 1
901 3
902 4
904 5


Issue: I have to delete Temp3ID's from Temp3 table which are having their Char2 as NULL. i.e (I have to delete
Records from Temp3 table having Temp3ID's {1,4,5} But Before deleting them i have to update the Temp3ID values in the 'matter' table. I have to replace Temp3ID '1' with '2' and Temp3ID '4' with '3' and Temp3ID '5' with '6'

My resultant tables should look like these


Table : Temp3
-----------------------------------
Temp3ID Char1 Char2
2 x1 312
3 x2 420
6 x3 889


Table : matter
--------------------------
MatterID Temp3ID
900 2
901 3
902 3
903 6

I had solved this using CURSORS but due to performance issues i cannot use them. Is there any other way to
handle this.



Thanks in advance!!
May 1 '11 #1
2 1553
ck9663
2,878 Expert 2GB
What's your basis on replacing the Temp3ID? I initially thought you want the next available value, but you lost me at "4" will become "3" part...

~~ CK
May 2 '11 #2
MrMob
27
UPDATE tableA
SET Colname = tableB.Column FROM tableA , tableB
WHERE tableA.COLID = tableB.COLID

HOpe this will help you as i understand.... Thankyou
Jul 13 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: PAUL | last post by:
Hello, I have 2 tables with a relationship set up in the dataset with vb ..net. I add a new record to the parent table then edit an existing child record to have the new parent ID. However when I...
5
by: Seth | last post by:
I have one table of the form: Delivery Product 101 A 101 B 101 C 102 A 102 E 103 C 104 A
4
by: Farraige | last post by:
Hi I need your help... I am implementing the method that updates given table (table is represented as list of lists of strings) according to other table (some kind of merging)... This method...
1
by: que576 | last post by:
I have created a junction table so that I can relate data from 2 other tables. Table 1 - Category Table (has the following fields with data) CatID (primary key) CategoryName CategoryStatus ...
6
by: tone | last post by:
Hi, got: ! ! How to overwrite (update) all elements of ! with Max (or latest) of ! ? I tried if with a Update-Querry - without success. Thankx
3
by: priyanka1915 | last post by:
Situation is : i got output like open=4324= volumn=435.456, change=56, etc... now i want to enter this value in table and this value updates after 3 sec and it should also update in dat table
4
rajiv07
by: rajiv07 | last post by:
Hi to all I want to know How to update null value in table. Is any idea please. Thanks Regards RajivGandhi
7
by: Sharma Neha | last post by:
How can i update the values in a table in database.The condition to update is a value in a textbox. I hav a textbox containing the order value.The table order_detail should be updated for its some...
3
by: pinko1204 | last post by:
My Update function cannot successful update to sql table even don't have any error. Please help to check .....thx PHP1 <?php require_once 'header.php'; ?> <style type="text/css"> <!--
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.