join problem or maybe group :(

From: "Ben-Nes Michael" <miki(at)canaan(dot)co(dot)il>
To: "postgres" <pgsql-general(at)postgresql(dot)org>
Subject: join problem or maybe group :(
Date: 2002-08-28 18:37:00
Message-ID: 002101c24ec1$e5bcb740$aa0f5ac2@canaan.co.il
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi All

I want to select sections using left join on articles, but i want to retrive
only one row from articles per section and the one should be the latest
art_date.

Can it be done ?

CREATE TABLE sections (
sec_id SERIAL PRIMARY KEY,
sec_name VARCHAR (30),
sec_order INT2
);

CREATE TABLE articles (
art_id SERIAL PRIMARY KEY,
sec_id INT4 REFERENCES sections ON UPDATE CASCADE ON DELETE CASCADE,
art_name VARCHAR (30),
art_date DATE
);

Cheer

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dan Ostrowski 2002-08-28 18:48:02 Re: Noobie Questions...
Previous Message Mohamed G M Hussien 2002-08-28 18:08:41 how to import