Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"field cannot be bound" 1

Status
Not open for further replies.

LeonAtRC

Programmer
Nov 25, 2002
101
US
Code:
Tbl_A
   fName
   fSex
   aKey

Tbl_B
   fHome
   fSex
   bKey

These two tables are inner joined on the aKey and bKey in a view (theVue) that outputs these fields:
Tbl_A.fName, Tbl_A.Sex, Tbl_B.fHome
(The keys and tbl_B.Sex are not included in the view.)

The query is:
Code:
SELECT * FROM theVue ORDER BY tbl_A.Sex

The error is:
Code:
The multi-part identifier "Tbl_A.sex" could not be bound.
When I DON'T qualify the orderby field:
Code:
SELECT * FROM theVue ORDER BY Sex
the query will run.

My question is why?

If I can't find an easy answer I have a lot of "un-qualifying" to do!




 
The view doesn't store original table with it. When you select from a view, the only 'table/alias' you can reference is theVue.

So, ORDER BY theVue.Sex will work. But references to the tables that produced the view will not.

PluralSight Learning Library
 
Thanks markos.
In 12 years I've never come across that!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top