| From: | Andy Lewis <alewis(at)themecca(dot)net> |
|---|---|
| To: | pgsql-sql(at)postgresql(dot)org |
| Subject: | 2 Table Select |
| Date: | 1999-05-27 16:23:59 |
| Message-ID: | Pine.LNX.4.05.9905271105190.22984-100000@tmg.themecca.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | 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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 1999-05-27 17:18:07 | Re: [SQL] notifying |
| Previous Message | JT Kirkpatrick | 1999-05-27 16:11:09 | RE: [SQL] select nextval. . . |