a Top-N styled SQL...something like


SELECT *
FROM
  (  SELECT *
      FROM tablename
      OREDER BY datestamp
   )
WHERE rownum < 8


Doug

-----Original Message-----
From: Lofback, Chris [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 26, 2004 12:09 PM
To: CF-Talk
Subject: PL/SQL stumper

I have a table like the following.  With just CFML (v5) and plain Oracle PL/SQL--ie, no temp tables or stored procedures--is there a way to get, say, the 7 most recent distinct providers?  I've tried every which way, even using QofQ with MAXROWS=7, but that only returned the first 7 distinct providers alphabetically.  I need to get the first 7 distinct providers in date order with newest first.  Can it be done without "getting fancy"?

Thanks,
Chris

PROVIDER DATESTAMP
Eckerd Drugs 25-MAY-04
Walmart 25-MAY-04
Walgreens 23-MAY-04
Publix 23-MAY-04
Hush Puppy Shoes 23-MAY-04
Publix 22-MAY-04
Walgreen's 20-MAY-04
Timmons Drugs 20-MAY-04
Publix Pharmacy 19-MAY-04
Walmart 16-MAY-04
Publix Pharmacy 16-MAY-04
Publix 14-MAY-04
Walmart 14-MAY-04
Publix 14-MAY-04
Walmart 14-MAY-04
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to