pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Altnerate Column Return Names
2+ messages / 2 participants
[nested] [flat]

* Altnerate Column Return Names
@ 2000-07-07 13:46  Thomas Swan <tswan@olemiss.edu>
  0 siblings, 1 reply; 2+ messages in thread

From: Thomas Swan @ 2000-07-07 13:46 UTC (permalink / raw)
  To: pgsql-sql


If I do a select * from table1, table2 where table1.id = table2.id I 
normally get two columns returned with a column identifier of id.

Such as

  id | name | data | id | name | data
----+------+------+----+------+------
     |      |      |    |      |

Is there anyway to get the result to return

  table1.id | table1.name | table1.data | table2.id | ,,,
-----------+-------------+-------------+-----------+- ...

It seems awkward, however the only way I've been able to work around this 
is to use column names prefixed with the table name.

One of my projects is using PHP and I"m sure that the hash table they 
create to select rows is determined from the column names returned from a 
query.

Thanks,
Thomas


... I feel like I ask some weird questions ...
-
- Thomas Swan
- ________________________________________
- Graduate Student  - Computer Science
- The University of Mississippi
-
- "People can be sorted into two fundamental groups,
- those that divide people into two groups and
- those that don't."




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Altnerate Column Return Names
@ 2000-07-08 00:09  Peter Eisentraut <peter_e@gmx.net>
  parent: Thomas Swan <tswan@olemiss.edu>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter Eisentraut @ 2000-07-08 00:09 UTC (permalink / raw)
  To: Thomas Swan <tswan@olemiss.edu>; +Cc: pgsql-sql

Thomas Swan writes:

> If I do a select * from table1, table2 where table1.id = table2.id I 
> normally get two columns returned with a column identifier of id.

>   id | name | data | id | name | data
> ----+------+------+----+------+------

> Is there anyway to get the result to return
> 
>   table1.id | table1.name | table1.data | table2.id | ,,,
> -----------+-------------+-------------+-----------+- ...

select table1.id as "whatever you want", table1.name as "whatever you
want", table1.data as "something", ...

You get the idea.


-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2000-07-08 00:09 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-07-07 13:46 Altnerate Column Return Names Thomas Swan <tswan@olemiss.edu>
2000-07-08 00:09 ` Peter Eisentraut <peter_e@gmx.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox