SQL Help

From: luisblock(at)amauta(dot)rcp(dot)net(dot)pe
To: pgsql-sql(at)postgresql(dot)org
Subject: SQL Help
Date: 2003-11-05 18:30:20
Message-ID: 1068057020.3fa941bce468d@oficina.rcp.net.pe
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-sql by date

  From Date Subject
Next Message Jeff Eckermann 2003-11-05 19:54:24 Re: Select and functions
Previous Message terry 2003-11-05 14:38:11 Re: Select and functions