Solved

SQL Update - Update Table from 2 others

Posted on 2013-05-31
3
408 Views
Last Modified: 2013-05-31
Hey Guys
I am looking to update my Parcel Table from the Segment & Street Table using and update trigger.
If Street_Full_Name is updated in Street table
Then update the Parcel Table, Small Catch (Subquery?)

Within the Parcel Table it only holds Segment_ID. Segment_ID is updated manually depending on Parcel locations.
Street_Full_Name is updated in Segment using the following Query
UPDATE Segment
SET Segment.street_Full_Name = st.street_Full_Name,
	from dbo.Street st
                INNER JOIN INSERTED i ON st.OID = i.OID
                INNER JOIN dbo.Segment s ON s.Street_ID = st.Street_ID

Open in new window

Segment connects to Street using the Street_ID
Parcel does not have the Street_ID, It has Segment_ID.
So how do i connect Parcel to Street(which is the base source for the Street_Name_Full column) Using the Segment_ID held in Segment.
3 table join type thing
Thanks
0
Comment
Question by:PtboGiser
3 Comments
 
LVL 32

Accepted Solution

by:
ewangoya earned 500 total points
ID: 39211586
here is the join

select *
from street st
inner join segment s on s.Street_ID = st.Street_ID
inner join parcel p on p.segment_id = s.segment_id

Open in new window

0
 
LVL 26

Expert Comment

by:Zberteoc
ID: 39211661
On what table is the trigger?
0
 

Author Closing Comment

by:PtboGiser
ID: 39211669
thx, i was thinking to complex. Friday afternoon!!!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now