Обсуждение: selecting a column average into table

Поиск
Список
Период
Сортировка

selecting a column average into table

От
"Shawhan, Douglas (GEAE, GECC)"
Дата:
Weeeellll...

I wish to select the average of a column populated with integers into a
table

I have established in my mind that:

select avg(nebbish.numbers) into shebang from numbers ;

ain't going to cut it. Can anyone point me in the right direction?

d

Re: selecting a column average into table

От
"James McMurry"
Дата:
This should work:

-- don't have to create the table if you already have one.
create table foo (
    answer float;
)

insert into foo (answer) select avg(numbers) from nebbish;

JM

----- Original Message -----
From: "Shawhan, Douglas (GEAE, GECC)" <douglas.shawhan@ae.ge.com>
To: <pgsql-novice@postgresql.org>
Sent: Tuesday, June 05, 2001 12:19 PM
Subject: [NOVICE] selecting a column average into table


> Weeeellll...
>
> I wish to select the average of a column populated with integers into a
> table
>
> I have established in my mind that:
>
> select avg(nebbish.numbers) into shebang from numbers ;
>
> ain't going to cut it. Can anyone point me in the right direction?
>
> d
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>