Friday, March 30, 2012

Multiple Join Query Problem

I am trying to update a field in TblA based on the contents of a field in
TblB where 4 conditions match but I can't get it to work. ere is what I
tried:
Update TblA t Set [Show Name] =
(Select Contest From TblB s
Where s.Date = t.Date,
s.RegionalCode = t.Regional,
s.unit = t.unit,
s.PF = t.[P or F])
How should that be coded?Update TblA Set [Show Name] =
(Select Contest From TblB s
Where s.Date = TblA.Date and
s.RegionalCode = TblA.Regional and
s.unit = TblA.unit and
s.PF = TblA.[P or F])|||Thanks. I was off on the wrong track.
Wayne
<markc600@.hotmail.com> wrote in message
news:1144491686.935456.163560@.v46g2000cwv.googlegroups.com...
> Update TblA Set [Show Name] =
> (Select Contest From TblB s
> Where s.Date = TblA.Date and
> s.RegionalCode = TblA.Regional and
> s.unit = TblA.unit and
> s.PF = TblA.[P or F])
>|||You might want a where clause in your query:
Update TblA Set [Show Name] =
(Select Contest From TblB s
Where s.Date = TblA.Date and
s.RegionalCode = TblA.Regional and
s.unit = TblA.unit and
s.PF = TblA.[P or F])
where exists
(Select Contest From TblB s
Where s.Date = TblA.Date and
s.RegionalCode = TblA.Regional and
s.unit = TblA.unit and
s.PF = TblA.[P or F])sql

No comments:

Post a Comment