Re: create table from regular expressions applied to rows of multiple tables

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: create table from regular expressions applied to rows of multiple tables
Дата
Msg-id 1339803368.20206.12.camel@sussancws0025
обсуждение исходный текст
Ответ на create table from regular expressions applied to rows of multiple tables  (e-letter <inpost@gmail.com>)
Ответы Re: create table from regular expressions applied to rows of multiple tables  (e-letter <inpost@gmail.com>)
Список pgsql-novice
On Thu, 2012-06-14 at 23:22 +0100, e-letter wrote:
> Readers,
>
> Tables contains text:
>
> table1
> text1, 10
> text2, 20
> text3, 30
> text4, 40
>
> table2
> text2, textB 20
> text3, textC 30
> text5, textD 50
> text6, textE 60
> text7, textF 70
> text8, textG 80
>
> Is it possible to create a new table (table3) using a regular
> expression (e.g. ^text*) to select rows which are of the same table
> format as table2:
>
> table3
> text2, textB 20
> text3, textC 30

I'm not sure I understand exactly what you're asking. Your example
table3 could also be produced by a simple inner join:

   SELECT table1.col1, table2.col2
   FROM table1, table2
   WHERE table1.col1 = table2.col1;

But postgresql also offers a lot of regular expression functions, too.
See:

http://www.postgresql.org/docs/9.2/static/functions-string.html
http://www.postgresql.org/docs/9.2/static/functions-matching.html

Or post a more detailed example to show what you are looking for.

Regards,
    Jeff Davis


В списке pgsql-novice по дате отправления:

Предыдущее
От: Josh Kupershmidt
Дата:
Сообщение: Re: Table name as a variable and/or EXECUTE and NEW.*
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Query Question