SQL Help - Mailing list pgsql-sql

From luisblock@amauta.rcp.net.pe
Subject SQL Help
Date
Msg-id 1068057020.3fa941bce468d@oficina.rcp.net.pe
Whole thread Raw
List pgsql-sql
PLS, help,

I am trying to JOIN two tables together with the LEFT OUTER JOIN statement, but 
with a twist:

1. table 1 id and table 2 projectid are the join field
2. Table 1 has de detail info for several ocurrences in table 2.  For each id 
in table 1 (project detail), there are many entries of projectid on table 2 
(update log on project)
3. I need a query that gets each project detail (table 1) with ONLY the LAST 
(most recent) update date and comment (table 2) for that project.

The result report will look something like this:

Repeat____________________________________________________
PROJECT NAME(table 1)   PROJECT DATE(table 1)    PROJECT OWNER(table 1)
LAST UPDATE(table 2)    LAST UPDATE COMMENT(table 2)
Repeat_____________________________________________________

I have used the SELECT TOP 1 function, the DISTINCT function, I am out of ideas.

Thanx

LuisFe


pgsql-sql by date:

Previous
From: Cris Carampa
Date:
Subject: transaction management in plpgsql functions
Next
From: Chris Bowlby
Date:
Subject: Re: [HACKERS] Schema boggle...