[SQL] How to alias table columns in result?

2005-08-10 Thread nori
Hi,

If I have:
1.) table car with columns index and name 
2.) table driver with columns index, name and car_index

and query:
SELECT d.*, c.* FROM driver as d LEFT OUTER JOIN car AS c ON
d.car_index=c.index;

How can I get results that have distinct names for columns (ex.
d.name, d.index, c.name, c.index,...)?

tnx
boris

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


Re: [SQL] How to alias table columns in result?

2005-08-11 Thread nori
Thanks

Sorry, my question was missing one important detail. My tables have
quite a lot columns (which unfortunately have same names in both
tables) so is it possible to do same as below but without specifying
alias for each column. Now my queries are long and they do not look
nice.

boris

On 8/11/05, Mischa Sandberg <[EMAIL PROTECTED]> wrote:
> SELECT d.name as "d.name",
>d.index as "d.index",
>c.name as "c.name",
>...

---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [SQL] How to alias table columns in result?

2005-08-11 Thread nori
Ok I got it. There is no way to alias all columns of some table with
some "prefix" that will be visible in result except to alias each
column.

Tnx Nick, Micsha
P.S. sorry for my bad english

On 8/11/05, Nick Stone <[EMAIL PROTECTED]> wrote:
> Yes - just alias the columns you need to alias
> 
> Nick
>

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org