Re: How to merge several attributes and Delete an attribute

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: "Yan Bai" <annie_job(at)hotmail(dot)com>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: How to merge several attributes and Delete an attribute
Date: 2002-01-31 07:57:12
Message-ID: GNELIHDDFBOCMGBFGEFOKEDOCBAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> Hello all,
>
> My initial table has 3 attributes: FirstName, MiddleName and
> LastName. Now I
> want to merge them into one, then I could make a search action using LIKE
> more easily.
> what should i do for that?

You add a new attribute and then run an update like this:

update table set newcol = FirstName||" "||MiddleName||" "||LastName;

But why do that??? Just do your like query as follows:

select * from table where FirstName like 'blah' or MiddleName like 'blah' or
LastName like 'blah';

> Also, I want to know how to delete one attribute from a table.

You cannot delete attributes in postgres - you just have to ignore them.
(Hint - 7.3 anyone...?)

chris

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Alex Ott 2002-01-31 10:43:23 working with sequences
Previous Message Yan Bai 2002-01-31 07:34:40 How to merge several attributes and Delete an attribute