pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: A. R. Van Hook <hook@lake-lotawana.mo.us>
To: pgsql-sql@postgresql.org
Subject: max question
Date: Tue, 12 Apr 2005 12:24:21 -0500
Message-ID: <425C0445.8020603@lake-lotawana.mo.us> (raw)

I have the following in a table:
   oid   |   citkey   |  contby  |  contdate  | abcontinue |   ccdate  
---------+------------+----------+------------+------------+------------
 5774835 | 04-0594703 |          |            |            |
 5775325 | 04-0594703 | Attorney | 04/06/2005 | 6          | 03/07/2005
 5776060 | 04-0594703 | Attorney | 05/04/2005 | 6          | 04/05/2005
 5776067 | 04-0594703 | Attorney | 05/04/2005 | 6          | 04/05/2005

I am trying to pull rows that have the max. contdate. Why does the 
following give more than 2 rows?
 ql "select oid,* from ccontinue where citkey ='04-0594703' group by 
oid,citkey,contby,contdate,abcontinue,ccdate having max(contdate) = 
contdate"
   oid   |   citkey   |  contby  |  contdate  | abcontinue |   ccdate  
---------+------------+----------+------------+------------+------------
 5776067 | 04-0594703 | Attorney | 05/04/2005 | 6          | 04/05/2005
 5775325 | 04-0594703 | Attorney | 04/06/2005 | 6          | 03/07/2005
 5776060 | 04-0594703 | Attorney | 05/04/2005 | 6          | 04/05/2005
(3 rows)

thanks




view thread (4+ messages)  latest in thread

Message-ID: <425C0445.8020603@lake-lotawana.mo.us>
Permalink:  ../425C0445.8020603@lake-lotawana.mo.us/
Also on:    postgresql.org/message-id/425C0445.8020603@lake-lotawana.mo.us

 · 

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: hook@lake-lotawana.mo.us
  Subject: Re: max question
  In-Reply-To: <425C0445.8020603@lake-lotawana.mo.us>

* 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