select few fields as a single field

From: Roman Gavrilov <romio(at)il(dot)aduva(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: select few fields as a single field
Date: 2002-01-10 09:50:08
Message-ID: 3C3D63D0.D56AA7E5@il.aduva.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello everybody,
I have this question,
Suppose that I have a table with 3 fields name, version, release.
name | version | release
------------------
test | 1 | 2
ema | 1.2 | 2.2
------------------

I want to retrieve full name as 'select name || '-' || version || '-'
release from table';
test-1-2
ema-1.2-2.2

I can do this as regular sql query;
But i would like to do this as 'select full_name from table'

One way is to create view which will do the job.
Other way to do this is to create additional field name full_name and to
store the full name inside the field.
Is there any possibility to create function or constraint trigger that
will know that when I am doing select full_name it should
concat name version release and return it as full_name.(full_name is
virtual field)
I don't want to create it as view;
------------------------

Thanks

--
-----------------------------------------------------------------------------
Roman Gavrilov
Aduva Inc., Web Development Services.
work +972-3-7534324 mobile +972-54-834668
romio(at)aduva(dot)com, romio(at)netvision(dot)net(dot)il

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Holger Krug 2002-01-10 10:25:31 Re: select few fields as a single field
Previous Message will trillich 2002-01-10 09:19:33 caching subtotals: update vs sum -- aaugh!