Re: SQL query - Mailing list pgsql-sql

From daq
Subject Re: SQL query
Date
Msg-id 19964409273.20040204084300@ugyvitelszolgaltato.hu
Whole thread Raw
In response to SQL query  (pawel@deso.pl (Paul Czubilinski))
List pgsql-sql
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



pgsql-sql by date:

Previous
From: Jan Wieck
Date:
Subject: Re:
Next
From: Jürgen Cappel
Date:
Subject: Update from same table