Re: How to merge several attributes and Delete an attribute - Mailing list pgsql-sql

From Christopher Kings-Lynne
Subject Re: How to merge several attributes and Delete an attribute
Date
Msg-id GNELIHDDFBOCMGBFGEFOKEDOCBAA.chriskl@familyhealth.com.au
Whole thread Raw
In response to How to merge several attributes and Delete an attribute  ("Yan Bai" <annie_job@hotmail.com>)
Responses Re: How to merge several attributes and Delete an attribute  (Tod McQuillin <devin@spamcop.net>)
List 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



pgsql-sql by date:

Previous
From: "Yan Bai"
Date:
Subject: How to merge several attributes and Delete an attribute
Next
From: Alex Ott
Date:
Subject: working with sequences