Top n in Oracle

2003-10-15 Thread Heald, Tim
I need to pull Top n (lets say three) from an oracle 8i db.Now SQL Server makes this really easy to do.How would I go about doing it in Oracle?I have tried sub selects and rownum and stuff, but the order gets al hosed up if I use those.Basically I need them ordered by date desc. Any help would

Re: Top n in Oracle

2003-10-15 Thread Thomas Chiverton
On Wednesday 15 Oct 2003 12:39 pm, Heald, Tim wrote: I need to pull Top n (lets say three) from an oracle 8i db.Now SQL Server makes this really easy to do.How would I go about doing it in Oracle?I have tried sub selects and rownum and stuff, but the order gets al hosed up if I use

RE: Top n in Oracle

2003-10-15 Thread Heald, Tim
AM To: CF-Talk Subject: Re: Top n in Oracle On Wednesday 15 Oct 2003 12:39 pm, Heald, Tim wrote: I need to pull Top n (lets say three) from an oracle 8i db.Now SQL Server makes this really easy to do.How would I go about doing it in Oracle?I have tried sub selects and rownum and stuff

RE: Top n in Oracle

2003-10-15 Thread Murat Demirci
did you try ... where rownum = 3 ... ? -Original Message- From: Heald, Tim [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 3:27 PM To: CF-Talk Subject: RE: Top n in Oracle The table has something like 250,000 records.The performance would make that impossible. Timothy

Re: Top n in Oracle

2003-10-15 Thread Thomas Chiverton
On Wednesday 15 Oct 2003 13:27 pm, Heald, Tim wrote: The table has something like 250,000 records.The performance would make that impossible. Have you looked at the docs for cfquery ? In particular maxRows ? If you query can't return 250K rows in something like stright away, you need to look

RE: Top n in Oracle

2003-10-15 Thread Heald, Tim
Subject: RE: Top n in Oracle did you try ... where rownum = 3 ... ? -Original Message- From: Heald, Tim [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 3:27 PM To: CF-Talk Subject: RE: Top n in Oracle The table has something like 250,000 records.The performance would make

FW: Top n in Oracle

2003-10-15 Thread Murat Demirci
There are some solutions at http://www.orafaq.org/faqsql.htm. -Original Message- From: Murat Demirci [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 3:32 PM To: '[EMAIL PROTECTED]' Subject: RE: Top n in Oracle did you try ... where rownum = 3 ... ? -Original Message

RE: Top n in Oracle

2003-10-15 Thread Samuel Neff
-- -Original Message- From: Heald, Tim [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 8:27 AM To: CF-Talk Subject: RE: Top n in Oracle The table has something like 250,000 records.The performance would make that impossible. Timothy Heald Information Systems Manager

RE: Top n in Oracle

2003-10-15 Thread Samuel Neff
] Sent: Wednesday, October 15, 2003 8:38 AM To: CF-Talk Subject: Re: Top n in Oracle On Wednesday 15 Oct 2003 13:27 pm, Heald, Tim wrote: The table has something like 250,000 records.The performance would make that impossible. Have you looked at the docs for cfquery ? In particular maxRows ? If you

Re: Top n in Oracle

2003-10-15 Thread Kevin Graeme
PROTECTED] Sent: Wednesday, October 15, 2003 7:38 AM Subject: FW: Top n in Oracle There are some solutions at http://www.orafaq.org/faqsql.htm. -Original Message- From: Murat Demirci [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 3:32 PM To: '[EMAIL PROTECTED]' Subject: RE

RE: Top n in Oracle

2003-10-15 Thread Plunkett, Matt
SELECT * FROM ( SELECT WHATEVER, YOU, NEEED FROM tablename ) WHERE rownum 4; Do your ordering in the inner query. -Original Message- From: Heald, Tim [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 7:40 AM To: CF-Talk Subject: Top n in Oracle I need to pull Top n (lets

Re: Top n in Oracle

2003-10-15 Thread Deanna Schneider
SELECT * FROM ( SELECT * FROM foo WHERE goo = 'koo' ORDER BY gooey ) WHERE rownum 101 - Original Message - From: Heald, Tim [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 6:39 AM Subject: Top n in Oracle I need to pull Top n (lets say three) from

RE: Top n in Oracle

2003-10-15 Thread Heald, Tim
these opinions been approved or sanctioned by these organizations. This e-mail is unclassified based on the definitions in E.O. 12958. -Original Message- From: Deanna Schneider [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 9:38 AM To: CF-Talk Subject: Re: Top n in Oracle SELECT

Re: Top n in Oracle

2003-10-15 Thread Dave Carabetta
I need to pull Top n (lets say three) from an oracle 8i db.Now SQL Server makes this really easy to do.How would I go about doing it in Oracle?I have tried sub selects and rownum and stuff, but the order gets al hosed up if I use those.Basically I need them ordered by date desc. Any help would be