I am joining two tables and fetching columns from two tables (App_Main & App_Test) and binding that to a grid. How can I write delete & update query having EAI Code as primary.
select Main.[EAI_Code], Main.[Active_Ind], Main.[App_Class],Main.[App_Long_Name],
Main.[App_Short_Name], Main.[App_Status], Main.[Critical_Ind], Main.[LOB],
Main.[Master_App_Id], Main.[Master_App_Name],Test.[App Name], Test.[Critical App],
Test.[L2 Group], Test.[L2 Subb Group], Test.[OBM Comments], Test.[OBM Status],
Test.[OBM Target Date], Test.[PM L2 Lead], Test.[Platform], Test.[Tricare]
from App_Main as Main inner join App_Test as Test on Main.[EAI_Code]= Test.[EAI code]
Loading
HanookPosted Nov 3, 2013, 11:40 PM
i think App_Main & App_Test are master & cild tables... So you should follow integrity constraints...
1) For delete operations you have to delete the child (APP_Test) data and then parent (App_Main) data...
DELETE FROM App_Test WHRE [EAI code] = SomeValue;
DELETE FROM App_Main WHRE [EAI code] = SomeValue; --if you wish to delete from parent table too
2) For update operation it depends on your requirement
For suppose you wish to update [App Name] in App_Test table
UPDATE App_Test SET [App Name] = 'SomeValue' WHERE
NOTE: can you elaborate the requirement of Delete & Update operations in your scenario
Vignesh KumarPosted Nov 1, 2013, 2:19 AM
venkata kumarPosted Nov 1, 2013, 1:48 AM
tell mee which table eaicode is primarykey