Re: How to merge several attributes and Delete an attribute

Поиск
Список
Период
Сортировка
От Christopher Kings-Lynne
Тема Re: How to merge several attributes and Delete an attribute
Дата
Msg-id GNELIHDDFBOCMGBFGEFOKEDOCBAA.chriskl@familyhealth.com.au
обсуждение исходный текст
Ответ на How to merge several attributes and Delete an attribute  ("Yan Bai" <annie_job@hotmail.com>)
Ответы Re: How to merge several attributes and Delete an attribute  (Tod McQuillin <devin@spamcop.net>)
Список 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 по дате отправления:

Предыдущее
От: "Yan Bai"
Дата:
Сообщение: How to merge several attributes and Delete an attribute
Следующее
От: Alex Ott
Дата:
Сообщение: working with sequences