Re: SQL query

From: daq <daq(at)ugyvitelszolgaltato(dot)hu>
To: pawel(at)deso(dot)pl ((Paul Czubilinski))
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: SQL query
Date: 2004-02-04 07:43:00
Message-ID: 19964409273.20040204084300@ugyvitelszolgaltato.hu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

  • SQL query at 2004-02-02 15:10:04 from Paul Czubilinski

Browse pgsql-sql by date

  From Date Subject
Next Message Jürgen Cappel 2004-02-04 16:46:19 Update from same table
Previous Message Jan Wieck 2004-02-03 22:52:08 Re: