Reputation: 82287
Given that this is defined in a mysql script:
`Project1`.`Id` AS `Id1d334656-0d51-4bf6-bb08-6c25d01e7745`
Does this mean that
`Project1`.`Id`
is no longer accessible by that name and only by
`Project1`.`Id1d334656-0d51-4bf6-bb08-6c25d01e7745`
?
Background: This script is being generated by MySqlConnector/net and this is part of the command that is generated.
Upvotes: 0
Views: 93
Reputation: 34367
Yes. Its pretty much like renaming the columns while selecting. Outside the select
query the columns should be referred using aliases but with-in the select query, you should use table column e.g. below:
select col1 as a
from table b
where col1 = 'xxx';
but outside select query, alias should be use:
select a
from (select col1 AS a From table) b
where a = 'xxxx';
If you attempt to use the table column, it will fail:
<<----FAILURE -->
select col1
from (select col1 AS a From table) b
where a = 'xxxx';
Upvotes: 1
Reputation: 360702
aliases have no table assignment, so it'd be just ID1d3346etc....
. If they did, that'd defeat the purpose of the aliases, e.g.
select table1.x AS abc, table2.x AS abc
would be an error, even though the two aliases are coming from different tables.
Upvotes: 2