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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 insert joined tables

Author  Topic 

eugz
Posting Yak Master

210 Posts

Posted - 2011-08-24 : 10:33:50
Hi All.

I have select statement:
select
u.[User_id]
,[user_name]
,First_name
,Last_name
,First_name + ' ' + Last_name FullName
from dbo.Users u
inner join dbo.UAGR ua
on u.[user_id] = ua.[user_id]
inner join dbo.AppG ag
on ua.AppG_id = ag.AppG_id
inner join dbo.AppR ar
on ua.AppR_id = ar.AppR_id
inner join dbo.App a
on ag.App_id = a.App_id

and I need INSERT and UPDATE UAGR table by fields user_id and App_id

Is it possible insert joined tables? If yes. How it to do?

Thanks.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-08-24 : 11:50:57
update would be like:-


update ua
ua.[user_id]=u.[User_id],
ua.[App_id]=a.[App_id]
from dbo.Users u
inner join dbo.UAGR ua
on u.[user_id] = ua.[user_id]
inner join dbo.AppG ag
on ua.AppG_id = ag.AppG_id
inner join dbo.AppR ar
on ua.AppR_id = ar.AppR_id
inner join dbo.App a
on ag.App_id = a.App_id


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -