Hello,
I am running a select statement from Mytable1. I am joining:
tbldocumentinfo to mytable1
tblland to tbldocumentinfo
tblacreage to tblland
Selecting columns from all 4 tables works fine with the following query:
However if I put a column prefix at the beginning of one of my fields I get the error: The column prefix 'tblacreage' does not match with a table name or alias name used in the query.
For example, this query gives me the error (note the tblacreage prefix for tisection):
Am I doing something wrong where I can't use a column prefix? There is one column name duplicated in two tables and I want to specify the table I want it to come from. I can't get it to work without this column prefix.
Thanks for looking!
I am running a select statement from Mytable1. I am joining:
tbldocumentinfo to mytable1
tblland to tbldocumentinfo
tblacreage to tblland
Selecting columns from all 4 tables works fine with the following query:
Code:
select col001, col002, col029, col030, col031, col032, col033, stownship, srange, tisection
from mytable1
left join tcrgrand..tbldocumentinfo on col002 = tcrgrand..tbldocumentinfo.sdocumentno
left join tcrgrand..tblland on tcrgrand..tbldocumentinfo.irecordid = tcrgrand..tblland.irecordid
left join tcrgrand..tblacreage on tcrgrand..tblacreage.ilandid = tcrgrand..tblland.ilandid
order by col002
However if I put a column prefix at the beginning of one of my fields I get the error: The column prefix 'tblacreage' does not match with a table name or alias name used in the query.
For example, this query gives me the error (note the tblacreage prefix for tisection):
Code:
select col001, col002, col029, col030, col031, col032, col033, stownship, srange, tblacreage.tisection
from mytable1
left join tcrgrand..tbldocumentinfo on col002 = tcrgrand..tbldocumentinfo.sdocumentno
left join tcrgrand..tblland on tcrgrand..tbldocumentinfo.irecordid = tcrgrand..tblland.irecordid
left join tcrgrand..tblacreage on tcrgrand..tblacreage.ilandid = tcrgrand..tblland.ilandid
order by col002
Am I doing something wrong where I can't use a column prefix? There is one column name duplicated in two tables and I want to specify the table I want it to come from. I can't get it to work without this column prefix.
Thanks for looking!