pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: pawel@deso.pl
To: pgsql-sql@postgresql.org
Subject: SQL query
Date: 2 Feb 2004 07:10:04 -0800
Message-ID: <bce5a17a.0402020710.4040123a@posting.google.com> (raw)

Hello,

I would like to retrieve all the records from table A which have given
lang_id and its modification date is later then modification date of
the same id record with lang_id='pl'.

Example:

table A - data example
======================
id      | modification_date   | lang_id
--------+---------------------+------
abc     | 2002-10-11 10:12:11 | en
abc     | 2002-11-12 11:12:11 | pl
abc     | 2002-11-11 18:12:00 | de
sample  | 2003-04-15 22:43:14 | pl
sample  | 2003-05-16 11:10:15 | en
sample  | 2003-11-11 18:11:10 | de

If given lang_id would be 'en' the following record should be choosed:

sample  | 2003-05-16 11:10:15 | en

(it has mofication date later then record with id = sample and lang_id
= pl)

If you have any idea how to make SQL query for this, please help me.

Thanx,
Paul Czubilinski



view thread (18+ messages)  latest in thread

Message-ID: <bce5a17a.0402020710.4040123a@posting.google.com>
Permalink:  ../bce5a17a.0402020710.4040123a@posting.google.com/
Also on:    postgresql.org/message-id/bce5a17a.0402020710.4040123a@posting.google.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: pawel@deso.pl
  Subject: Re: SQL query
  In-Reply-To: <bce5a17a.0402020710.4040123a@posting.google.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox