You do not have table aliases; you are also an instance of a table link.
This allows you to join yourself, etc., since you have multiple instances of links to the same physical table. This is not the case when each AS gives this table a new name in another place, it is just an alias related to this particular link.
In your case, there are two show stoppers ...
The inserted table itself is not part of the select query, it is not a reference set in the same way as foo , bar or baz , for example. Thus, you cannot use his pseudonym (because there is no need, you can never refer to it).
In addition, even if that were the case, you cannot reference the entire table through an alias. You refer to a field as part of a query repeating through a set. For example, this does not work either ...
SELECT * FROM myTable AS xxx WHERE id = (SELECT MAX(id) FROM xxx)
You can get around the last example using ...
WITH xxx AS (SELECT * FROM myTable) SELECT * FROM xx WHERE id = (SELECT MAX(id) FROM xxx)
But this still brings us back to the first point, the inserted table never refers to the request part of your statement.
The only way I can get closer is to create a view ...
MatBailie
source share