pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: jack <datactrl@tpg.com.au>
To: dima <_pppp@mail.ru>
Cc: pgsql-sql@postgresql.org
Subject: Re: the best way to get the topest 3 record in every group
Date: Mon, 9 Sep 2002 18:08:21 +1000
Message-ID: <000701c257d8$1163c9a0$1400a8c0@jac> (raw)
References: <002201c25796$d923d3f0$1400a8c0@jac>
	<3D7C4108.70407@mail.ru>

Dima
My question is that I want to produce ALL the lastest 3 records for EACH
itemNo and supplier.

Jack
----- Original Message -----
From: "dima" <_pppp@mail.ru>
To: "jack" <datactrl@tpg.com.au>
Cc: <pgsql-sql@postgresql.org>
Sent: Monday, September 09, 2002 4:34 PM
Subject: Re: [SQL] the best way to get the topest 3 record in every group


> > There is a table like :
> > <<
> > itemNo
> > supplier
> > purchaseDate
> > Price
> > Qty
> > <<
> > Please provide an idea if I want to get the latest 3 puchase records for
> > each item and supplier. Thank you in advance.
> select * from table_name where supplier=value order by purchaseDate desc
> limit 3
> ???
>
>




view thread (7+ messages)  latest in thread

Message-ID: <000701c257d8$1163c9a0$1400a8c0@jac>
Permalink:  ../000701c257d8$1163c9a0$1400a8c0@jac/
Also on:    postgresql.org/message-id/000701c257d8$1163c9a0$1400a8c0@jac

 · 

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: datactrl@tpg.com.au, _pppp@mail.ru
  Subject: Re: the best way to get the topest 3 record in every group
  In-Reply-To: <000701c257d8$1163c9a0$1400a8c0@jac>

* 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