2 Table Select
От | Andy Lewis |
---|---|
Тема | 2 Table Select |
Дата | |
Msg-id | Pine.LNX.4.05.9905271105190.22984-100000@tmg.themecca.net обсуждение исходный текст |
Ответы |
Re: [SQL] 2 Table Select
|
Список | pgsql-sql |
I am trying to get the _total_ number of jobs that each company has in the db. In other words I want to get each distinct company that has jobs in the jobs table and the _total_ number of jobs that it has in the jobs table. What would be the best query that I could use? I'm using 6.4.2. Table = jobs +-------------+---------------+-------+ | Field | Type | Length| +-------------+---------------+-------+ | job_id | int4 not null | 4 | | company_id | int4 | 4 | | title | varchar() | 50 | ... +-------------+---------------+-------+ Table = company +--------------+---------------+-------+ |Field |Type | Length| +--------------+---------------+-------+ | company_id | int4 not null | 4 | | company_name | varchar() | 100 | | email | varchar() | 100 | ... +--------------+---------------+-------+ Thanks Andy
В списке pgsql-sql по дате отправления: