473,386 Members | 1,842 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,386 software developers and data experts.

Update help requested

1
SQL newby in deep water thats way over my head. Any help appreciated.
I am trying to retrieve data from field in one table and append it to on field in a second table. Each the fields had a Field ID that is different for each. The rows also have no way to relate to each other without linking through a third table. And just for fun I need to restrict the update to only a subset of the rows in TableB

So it looks like this:
TableA TableB TableC
Field1 (ID=20) Field2 (ID=22) TempID
TempID IssueID IssueID

And I tried to do this
Update TA
Set TA.F1=TA.F1 + TB.F2
Where (TA.ID=20) AND (TB.ID=22) AND (TB.IssueID=TC.IssueID) AND (TC.TempID=TA.TempID) AND (TB.IssueID>2200)
Aug 25 '06 #1
2 1491
vssp
268 100+
hai friend
I give you quick idea. I think may be this idea help for you.
Fisrt writ ethe select statement an reterive the two table values and stored new variables .
And append the variable simple use this variable to update query.

This is for ru using any application for used the update query .

Not use in commend prompt
Aug 26 '06 #2
ronverdonk
4,258 Expert 4TB
Don't know about standard SQL, but in MySql i would do something like this:

Expand|Select|Wrap|Line Numbers
  1. UPDATE TA, TB, TC
  2. SET    TA.F1=TA.F1 + TB.F2
  3. WHERE (TA.ID=20) 
  4.   AND (TB.ID=22) 
  5.   AND (TB.IssueID=TC.IssueID) 
  6.   AND (TC.TempID=TA.TempID) 
  7.   AND (TB.IssueID>2200)
Ronald :cool:
Aug 26 '06 #3

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

Similar topics

2
by: Reply via newsgroup | last post by:
Folks, When performing an update in mysql (using PHP), can I find out how many records were matched? mysql_affected_rows() won't work... and I have the following problem that I thought I...
3
by: Fredrik/Sweden | last post by:
Hi folks ! got this problem... i have a table 'Accounts' in my database, which contains a bunch of users. From the main menu i choose "edit user" and all users in the db are presented in a table....
1
by: revolnip | last post by:
As attached is the code : <% Option Explicit dim lngTimer lngTimer = Timer %> <!--#include file="Connect.asp" --> <!--#include file="Settings.asp" --> <!--#include file="Common.asp" -->
7
by: Justin | last post by:
I am extremely new at SQL Server2000 and t-sql and I'm looking to create a simple trigger. For explanation sake, let's say I have 3 columns in one table ... Col_1, Col_2 and Col_3. The data type...
5
by: A.Dagostino | last post by:
hi i need to update an SQL Table when user select or unselect a checkbox control. How Can i do? Thanks Alex
7
by: Steve B. | last post by:
Does anyone know why the DA Update() would throw an exception? I moved the database but I updated the Conn and the DA, currently (trying)removing/replacing DS. Is there a another direction I...
30
by: Bruce Momjian | last post by:
I have events in the next few weeks in New York City, Copenhagen, Paris, and Atlanta. Check the News section on the web site for more information. I will also be in Amsterdam February 2-3, though...
4
by: pike | last post by:
DB2 UDB 8.1 FP7 We are getting intermittent deadlocks (911 RC 2) even when U row-lock has been secured. The transaction is as follows: 1) Select current application number value from table....
2
by: devine | last post by:
Hi All, I am trying to send an automatic email when an update has been made. My update statement will updates 6 fields, and dependant on one of the fields, I would like to send an email using CDO....
2
by: sirdavethebrave | last post by:
Hi guys - I have written a form, and a stored procedure to update the said form. It really is as simple as that. A user can go into the form, update some fields and hit the update button to...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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: 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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.