Create a table B with data coming from table A

Поиск
Список
Период
Сортировка
От lhaj.merigh@gmail.com
Тема Create a table B with data coming from table A
Дата
Msg-id 1181597039.682005.104060@k79g2000hse.googlegroups.com
обсуждение исходный текст
Ответы Re: Create a table B with data coming from table A  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Список pgsql-general
My original table is like that:

ID    A1    A2    A3    cnt
1234    1    0    0    4
1234    1    0    1    8
1234    1    1    1    5
1235    1    0    0    6
1235    1    0    1    7
1235    1    1    1    12

I have to create a new table B:

ID    B1    B2    B3    S
1234    4    8    5    17
1235    6    7    12    25

The combination (A1=1,A2=0,A3=0) gives B1
The combination (A1=1,A2=0,A3=0) gives B2
The combination (A1=1,A2=1,A3=1) gives B3

S = B1+B2+B3

I think it's a classical problem, but i can't see to problem key

Thx,
Lhaj


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

Предыдущее
От: Johannes Konert
Дата:
Сообщение: Re: Suppress checking of chmod 700 on data-dir?
Следующее
От: "A. Kretschmer"
Дата:
Сообщение: Re: Create a table B with data coming from table A