aggregate question

Поиск
Список
Период
Сортировка
От Ryan
Тема aggregate question
Дата
Msg-id 54717.65.102.128.233.1056394792.squirrel@fordparts.com
обсуждение исходный текст
Ответы Re: aggregate question  (Tomasz Myrta <jasiek@klaster.net>)
Re: aggregate question  (Hubert Lubaczewski <hubert.lubaczewski@eo.pl>)
Список pgsql-sql
I know this one is simple enough.

I have two tables: packages and package_log.

paulsonsoft=# \d packages                                  Table "public.packages"    Column      |  Type   |
                Modifiers
 
-----------------+---------+------------------------------------------------------------------package_name    | text
|not nullpackage_desc    | text    | not nullpackage_ver     | text    | not nullpackage_date    | text    | not
nullpackage_loc    | text    | not nullpackage_type    | text    | not nullpackage_creator | text    |package_status  |
boolean| default truepackage_id      | integer | not null default
 
nextval('public.packages_package_id_seq'::text)
Indexes: packages_pkey primary key btree (package_id)
Foreign Key constraints: $1 FOREIGN KEY (package_type) REFERENCES
package_types(package_type) ON UPDATE CASCADE ON DELETE RESTRICT

paulsonsoft=# \d package_log                              Table "public.package_log"  Column    |  Type   |
              Modifiers
 
-------------+---------+-----------------------------------------------------------------custno      | text    | not
nullpackage_id | text    |timestamp   | text    | not nullip_address  | text    | not nullcompleted   | boolean
|current_ver| text    |logo        | text    |licenses    | text    |log_id      | integer | not null default
 
nextval('public.package_log_log_id_seq'::text)
Foreign Key constraints: $1 FOREIGN KEY (package_id) REFERENCES
packages(package_id) ON UPDATE CASCADE ON DELETE RESTRICT

I must be a total space case today because I can't hammer out the sql to
get a listing of all the packages with a count() of the package_log by
package_id.

Thanks,
Ryan




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

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: multi-table unique index
Следующее
От: Tomasz Myrta
Дата:
Сообщение: Re: aggregate question