X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id DF158D1C9FB for ; Wed, 4 Feb 2004 07:48:40 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 46081-05 for ; Wed, 4 Feb 2004 03:48:36 -0400 (AST) Received: from tarzan.ugyvitelszolgaltato.hu (unknown [213.163.26.102]) by svr1.postgresql.org (Postfix) with ESMTP id 5207ED1D2D0 for ; Wed, 4 Feb 2004 03:48:27 -0400 (AST) Received: from DAQ ([193.80.82.4]) by tarzan.ugyvitelszolgaltato.hu (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id PAA03168; Wed, 4 Feb 2004 15:39:14 +0100 X-Authentication-Warning: tarzan.ugyvitelszolgaltato.hu: Host [193.80.82.4] claimed to be DAQ Date: Wed, 4 Feb 2004 08:43:00 +0100 From: daq X-Mailer: The Bat! (v1.53d) Business Reply-To: daq X-Priority: 3 (Normal) Message-ID: <19964409273.20040204084300@ugyvitelszolgaltato.hu> To: pawel@deso.pl ((Paul Czubilinski)) Cc: pgsql-sql@postgresql.org Subject: Re: SQL query In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/44 X-Sequence-Number: 16735 PC> Hello, PC> I would like to retrieve all the records from table A which have given PC> lang_id and its modification date is later then modification date of PC> the same id record with lang_id='pl'. PC> Example: PC> table A - data example PC> ====================== PC> id | modification_date | lang_id PC> --------+---------------------+------ PC> abc | 2002-10-11 10:12:11 | en PC> abc | 2002-11-12 11:12:11 | pl PC> abc | 2002-11-11 18:12:00 | de PC> sample | 2003-04-15 22:43:14 | pl PC> sample | 2003-05-16 11:10:15 | en PC> sample | 2003-11-11 18:11:10 | de select * from a where lang_id='en' and modification_date>(select modification_date from a as a_alias where a_alias.id=a.id and a_alias.lang_id='pl') Try this! DAQ