Solved

SQL Update - Update Table from 2 others

Posted on 2013-05-31
3
421 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 32

Accepted Solution

by:
Ephraim Wangoya 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 27

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

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.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

688 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