I have a pass-through query that returns two columns with the same name and I can't figure out how to refer to the second one. Using 'CustName' returns the value from the first column named CustName in the query. How can I refer to the second one?
Note: I can't alias the field names in the pass-through query. The ODBC driver doesn't support column name aliasing.
Example:
SELECT CustName, CustName, CustName (it will always return the value in the first column named 'CustName')
FROM OpenQuery(LinkedServerData,
'SELECT BC.CustName, SC.CustName
FROM InvoiceTable IT
INNER JOIN Cust BC ON IT.BillTo=BC.CustID
INNER JOIN Cust SC ON IT.ShipTo=SC.CustID')
Anyone have an answer for this? I'm stumped.
Note: I can't alias the field names in the pass-through query. The ODBC driver doesn't support column name aliasing.
Example:
SELECT CustName, CustName, CustName (it will always return the value in the first column named 'CustName')
FROM OpenQuery(LinkedServerData,
'SELECT BC.CustName, SC.CustName
FROM InvoiceTable IT
INNER JOIN Cust BC ON IT.BillTo=BC.CustID
INNER JOIN Cust SC ON IT.ShipTo=SC.CustID')
Anyone have an answer for this? I'm stumped.