Re: [SQL] distinguishing identical columns after joins

2011-03-02 Thread S G
> I don't suppose > there's a way to do this with functions that define multiple OUT > parameters in lieu of a custom composite type? Just had to dig a little further. Found my own answer in INFORMATION_SCHEMA.PARAMETERS. Though I wish the specific_name column didn't have that integer tagged at

Re: [SQL] distinguishing identical columns after joins

2011-03-02 Thread S G
>> But I still wonder it isn't a receiver/UI issue.  Does your reader know >> the meaning of "a_" vs "b_" in a non-trivial self join?  Wouldn't you >> rather have the output as a_col1, b_col1, a_col2, b_col2 ... for easy >> comparison.  And who can make sense of a 100 column results set anyway?:)

Re: [SQL] distinguishing identical columns after joins

2011-03-01 Thread Lee Hachadoorian
On 03/01/2011 06:00 PM, Rob Sargent wrote: > > On 03/01/2011 03:13 PM, S G wrote: >> On Tue, Mar 1, 2011 at 2:53 PM, Rob Sargent wrote: >>> >>> On 03/01/2011 12:47 PM, S G wrote: This question is particularly geared towards self-joins, but can apply to any join where the tables involved

Re: [SQL] distinguishing identical columns after joins

2011-03-01 Thread Stephen Cook
In times like these, I usually write a query using information_schema.columns to generate the column list: SELECT ordinal_position, 1 AS table_instance, 'a.' || column_name || ' AS ' || column_name || '_a,' FROMINFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'your_table_her

Re: [SQL] distinguishing identical columns after joins

2011-03-01 Thread Rob Sargent
On 03/01/2011 03:13 PM, S G wrote: > On Tue, Mar 1, 2011 at 2:53 PM, Rob Sargent wrote: >> >> >> On 03/01/2011 12:47 PM, S G wrote: >>> This question is particularly geared towards self-joins, but can apply >>> to any join where the tables involved have any identical column names. >>> Aside fro

Re: [SQL] distinguishing identical columns after joins

2011-03-01 Thread S G
On Tue, Mar 1, 2011 at 2:53 PM, Rob Sargent wrote: > > > On 03/01/2011 12:47 PM, S G wrote: >> This question is particularly geared towards self-joins, but can apply >> to any join where the tables involved have any identical column names. >>  Aside from explicit column references, is there any wa

Re: [SQL] distinguishing identical columns after joins

2011-03-01 Thread Rob Sargent
On 03/01/2011 12:47 PM, S G wrote: > This question is particularly geared towards self-joins, but can apply > to any join where the tables involved have any identical column names. > Aside from explicit column references, is there any way to pull all > columns (*) from each table in a join and q

[SQL] distinguishing identical columns after joins

2011-03-01 Thread S G
This question is particularly geared towards self-joins, but can apply to any join where the tables involved have any identical column names. Aside from explicit column references, is there any way to pull all columns (*) from each table in a join and quickly append/prepend some identifier to dist