I have a bunch of fields named the same across multiple tables (I inherited it – don’t blame me ;).
Instead of setting up all of the aliases verbosely, is it possible to assign/prepend an alias automatically by way of a wildcard?
I’m envisioning something like (which of course doesn’t really work):
SELECT t1.*,t2.* as alias2.*, t3.* as alias3.*
So I would get returned fields like:
name, address, city, state
alias2.name, alias2.address, alias2.city, alias2.state
alias3.name, alias3.address, alias3.city, alias3.state
This does, if you use it as:
Define the table alias, then you can use the table alias.* in the SELECT. But it’s still going to make getting the correct
address/etc field a pain without a unique column alias…Disclaimer
I only used ANSI-89 syntax for brevity – honest.