Selecting from two tables - Mailing list pgsql-php

From Michael Hanna
Subject Selecting from two tables
Date
Msg-id 05A7AFE7-46EA-11D8-A66C-000A95B34330@sympatico.ca
Whole thread Raw
In response to Auto commit Off how will it effect us ?  (SaiHertz And Control Systems <sank89@sancharnet.in>)
List pgsql-php
  I have a table called Jobs and another called Applications. I can
query all Job rows, but how do I also include the number of Application
rows for each Job row in the SELECT statement?

applications has a jobid foreign key

create table job (      jobid SERIAL,
                         login varchar(40),
                         jobtitle varchar(70),
                         jobdescrip TEXT,
                         jobkeywords TEXT,
                         valid int2 NOT NULL,
                         postdate TIMESTAMPTZ,
                         PRIMARY KEY (jobid),
                         FOREIGN KEY(login) REFERENCES company
                             ON DELETE CASCADE
                         );


CREATE TABLE application        (   applid SERIAL,
                                     jobid INTEGER,
                                     login varchar(6),
                                     apldate TIMESTAMPTZ,
                                     PRIMARY KEY (applid),
                                     FOREIGN KEY (jobid) REFERENCES job
                                         ON DELETE CASCADE,
                                     FOREIGN KEY (login) REFERENCES
student
                                         ON DELETE CASCADE
                                 );



thanks for any help on this..
Michael


pgsql-php by date:

Previous
From: "scott.marlowe"
Date:
Subject: Re: pg_connect socket creation error (0x0000273F)
Next
From: "Nick Barr"
Date:
Subject: Re: Selecting from two tables