This doesn't quite do it.  The problem is that the recordset from which it gets the first 7 (by rownum) is alphabetical.  So the 7 records are the first 7 of the alphabetically sorted group, not the first 7 by date (which could then be sorted alpha using QofQ).  I don't know if I'm explaining this clearly--but does that make sense?


Thanks again,
Chris

-----Original Message-----
From: Jochem van Dieten [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 26, 2004 1:25 PM
To: CF-Talk
Subject: Re: PL/SQL stumper

Lofback, Chris wrote:

> This throws an error:
>  
> ORA-00937: not a single-group group function

Forgot the GROUP BY:

SELECT *
FROM (
SELECT provider,
MAX(datestamp) AS lastDate
FROM table
GROUP BY provider
ORDER BY MAX(datestamp) DESC
) a
WHERE rownum < 8

Jochem
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to