UPDATE 1 Table with information from 2 Others

dprichard

Registered User.
Local time
Today, 12:43
Joined
Jun 23, 2008
Messages
14
Okay, I have been screwing around with Joins and Unions and can't quite get this right. I have one table I am trying to update with information from 2 others, but I can't get this working.

I need to say something like this:

UPDATE Table1 SET Table1.CustId = Table2.CustId, Table1.FirstName = Table2FirstName, Table1.Email = Table3.Email WHERE Table2.CustId = Table3.CustId
 
You shouldn't be storing anything BUT the id's in the one table. You already have that information stored in the other two tables and you should not be pulling the information and then storing it again. That is redundant data and violates the rules of normalization.

So, I gotta ask, "What is the purpose of storing it in this other table?"
 
Bob, Thanks for the quick reply. I can't modify any of the existing tables is the reason for me wanting to throw it in a separate table. We are trying to pull some data into a script that generates an XML page on the fly, but the client is using a really crappy ODBC drive that doesn't support very many expressions. I need to say something like this:

SELECT rcust.CustId, iusr_lu.UFST , iusr_lu.ULST, iusr_lu.UNM, rcust.CustAdd1, rcust.CustAdd2, rcust.CustCity, rcust.CustState, rcust.CustZip From iusr_lu, rcust WHERE Mid(iusr_lu.UVAR, (InstrRev(iusr_lu.UVAR, " ") + 1)) = rcust.CustId GROUP BY rcust.CustId, iusr_lu.UFST, iusr_lu.ULST, iusr_lu.UNM, rcust.CustAdd1, rcust.CustAdd2, rcust.CustCity, rcust.CustState, rcust.CustZip;

But the ODBC driver doesn't support MID or INSTRTEV so I am trying to pull it into a temporary table I created so I can just straight up query that table with the crappy ODBC driver.
 

Users who are viewing this thread

Back
Top Bottom