pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedDefault column titles in a select...
4+ messages / 4 participants
[nested] [flat]
* Default column titles in a select...
@ 2003-02-19 14:25 Axel Schlueter <axel@pqrs.de>
2003-02-19 15:07 ` Re: Default column titles in a select... greg@turnstep.com
2003-02-19 15:22 ` Re: Default column titles in a select... Bruno Wolff III <bruno@wolff.to>
0 siblings, 2 replies; 4+ messages in thread
From: Axel Schlueter @ 2003-02-19 14:25 UTC (permalink / raw)
To: pgsql-sql
Hi,
maybe it's a novice question, but I stumpled across
the following problem and couldn't find a solution:
create table c(
atext varchar
);
create table a(
objid smallint,
)INHERITS(c);
create table b(
objid smallint,
)INHERITS(c);
insert into a values(1,'foobar');
insert into b values(1,'carcddr');
When doing the following select statement:
select * from a,b where a.objid=b.objid
postgresql returns four columns labeled
objid atext objid atext
instead of what I expected:
a.objid a.atext b.objid b.atext
With the current result I'm unable to differentiate
between the two 'atext' column. Is there any possibility
to get column headers including the table name in the
result ?
Bye,
Axel
--
"The virus spreads using a Microsoft
vulnerability known as 'MS SQL Server'"
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Default column titles in a select...
2003-02-19 14:25 Default column titles in a select... Axel Schlueter <axel@pqrs.de>
@ 2003-02-19 15:07 ` greg@turnstep.com
1 sibling, 0 replies; 4+ messages in thread
From: greg@turnstep.com @ 2003-02-19 15:07 UTC (permalink / raw)
To: pgsql-sql
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
>When doing the following select statement:
> select * from a,b where a.objid=b.objid
>postgresql returns four columns labeled
> objid atext objid atext
>instead of what I expected:
> a.objid a.atext b.objid b.atext
You will have to explicitly specify them yourself:
SELECT a.objid AS "a.objid", a.atext AS "a.atext",
b.objid AS "b.objid", b.atext AS "b.atext"
to get the results you want.
- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200302191003
-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html
iD8DBQE+U5zTvJuQZxSWSsgRAlxWAKDrB+q9NsiXLAsudRQDu+2p7ma94wCeKMC/
box5pl2CIsjsjD979gKZ3/8=
=0k+n
-----END PGP SIGNATURE-----
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Default column titles in a select...
2003-02-19 14:25 Default column titles in a select... Axel Schlueter <axel@pqrs.de>
@ 2003-02-19 15:22 ` Bruno Wolff III <bruno@wolff.to>
1 sibling, 0 replies; 4+ messages in thread
From: Bruno Wolff III @ 2003-02-19 15:22 UTC (permalink / raw)
To: Axel Schlueter <axel@pqrs.de>; +Cc: pgsql-sql
On Wed, Feb 19, 2003 at 15:25:41 +0100,
Axel Schlueter <axel@pqrs.de> wrote:
>
> When doing the following select statement:
> select * from a,b where a.objid=b.objid
> postgresql returns four columns labeled
> objid atext objid atext
> instead of what I expected:
> a.objid a.atext b.objid b.atext
Use something like:
select a.objid as "a.objib", a.atext as "a.atext", b.objid as "b.objid",
b.atext as "b.atext" from a,b where a.objid=b.objid;
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Default column titles in a select...
@ 2003-02-19 15:10 Christoph Haller <ch@rodos.fzk.de>
0 siblings, 0 replies; 4+ messages in thread
From: Christoph Haller @ 2003-02-19 15:10 UTC (permalink / raw)
To: pgsql-sql; +Cc: axel@pqrs.de
>
> When doing the following select statement:
> select * from a,b where a.objid=b.objid
> postgresql returns four columns labeled
> objid atext objid atext
> instead of what I expected:
> a.objid a.atext b.objid b.atext
>
> With the current result I'm unable to differentiate
> between the two 'atext' column. Is there any possibility
> to get column headers including the table name in the
> result ?
>
SELECT a.objid AS a_objid, a.atext AS a_atext, b.objid AS b_objid,
b.atext AS b_atext
FROM a, b WHERE a.objid=b.objid ;
Does this help? Probably not really.
Regards, Christoph
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2003-02-19 15:22 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-02-19 14:25 Default column titles in a select... Axel Schlueter <axel@pqrs.de>
2003-02-19 15:07 ` greg@turnstep.com
2003-02-19 15:22 ` Bruno Wolff III <bruno@wolff.to>
2003-02-19 15:10 Re: Default column titles in a select... Christoph Haller <ch@rodos.fzk.de>
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