Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I have the following query but I get an error when I run it:
The multi-part identifier "Client.ClientUID" could not be bound.
Can anyone see why?
SELECT t1.Name, t1.PeriodName
FROM (SELECT ClientRegion.Name, ClientPeriodBrief.PeriodName, Visit.Period, Visit.VisitUID
FROM Visit
INNER JOIN BatchedVisitScores ON BatchedVisitScores.VisitUID = Visit.VisitUID AND BatchedVisitScores.BranchUID = Visit.BranchUID
INNER JOIN ClientPeriodBrief ON ClientPeriodBrief.PeriodBriefUID = Visit.Period
INNER JOIN ClientRegion ON ClientRegion.ClientUID = Client.ClientUID
INNER JOIN Branch ON Branch.BranchUID = Client.ClientUID
INNER JOIN Client ON Client.ClientUID = Branch.ClientUID
WHERE Client.ClientUID = @ClientUID
) AS t1GROUP BY t1.PeriodName, t1.Name

without the schema for these tables, it's hard to give you a fixed script, but I've run a few examples here and it looks like you have one of the two possible scearions preventing you from getting this working.
1. Using a reference to an undefined table
so in your query, you are requesting SQL to join clientRegion on ClientRegion.ClientUID to Client.ClientUID but you haven't defined Client yet.
2. There is no association between the ClientRegion and previous tables.
this is a disconnect that will cause you problems.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |