On Sat, Oct 24, 2015 at 6:41 AM, Rafal Pietrak <ra...@ztk-rp.eu> wrote:
> The only way I know to avoid the column name > duplication is to explicity select column list: > SELECT s.sled,s.length,s....,r.runner as right,r.length as > right_length,r....,l.runner as left,l.length as left_length,l.* FROM > sleds s JOIN runners l ON (s.left=l.runner) JOIN runners r ON > (s.right=r.runner); > .... which is truely overtalkative (and thus obfuscates future query > analize during code maintenance). > Skimmed... Using explicit column names is expected - using "*" in non-trivial and production queries is not. You can move the aliases if you would like. SELECT * FROM tablea (col1, col2, col4) JOIN tableb AS tb1 (col1, col3, col5) USING (col1) JOIN tableb AS tb2 (col1, col6, col7) USING (col1) The "USING" clause ensure that only a single "col1" appears in the output. For all other columns in the duplicate join you need to provide a context-specific alias. David J.