Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
tooba
Posting Yak Master
224 Posts |
Posted - 2013-12-23 : 22:02:05
|
Posted - 12/23/2013 : 18:25:50 Show Profile Reply with QuoteHere is my Test Data, Please any advise would be great appreciated.CREATE TABLE Table1(ID NVARCHAR(50),FName NVARCHAR(50),LName NVARCHAR(50),DOB NVARCHAR(50),Active bit)Create Table Table2(ID NVARCHAR(50),PID NVARCHAR(50),Phone NVARCHAR(50),Address NVARCHAR(50))Create TABLE Tbale3(PID NVARCHAR(50),OInfo NVARCHAR(50))--Insert Table1Insert into Table1 (ID,FNAME,LName,DOB)VALUES ('1','Smith','Tom','12/12/2011')Insert into Table1 (ID,FNAME,LName,DOB)VALUES ('2','Smith','Tom','12/12/2011')--Insert Table2Insert into Table2 (ID,PID,PHONE,Address)VALUES ('1','101','5178896566','Test Ave')-- Insert Table3Insert Into Tbale3VALUES ('101','Active Order')-- Here is my question....I am Creating a Front End for this, the user is going to SELECT Witch rows they want to MERGE.here is the update i need from first tableID FName LName DOB ISactive1 Smith Tom 12/12/2011 NULL2 Smith Tom 12/12/2011 NULLLet Say user select ID = 1 they wants to merge so I want to update in TABLE1 ISactive = 1 for ID=1and in TABLE2, update ID = 2, data look like thisID PID Phone Address2 101 5178896566 Test Aveand in TABLE3, UPDATE PID = 101PID OderInfo101 Active OrderPlease feel free to let me know if my questino is not clear and doesn't make sens. Thanks in advance. |
|
|
|
|
|
|