473,320 Members | 2,083 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

does sqlplus support :"select top 10 * from table1" syntax like MS SQL?

I would like to select the top 10 record from a table? How can I do it?
In MS SQL, it's easy using select top 10 from table1. But in oracle database,
I can't use top, anyone have any suggestions? Thanks!
Jul 19 '05 #1
1 27421

"mlke" <ml***@hotmail.com> wrote in message
news:df**************************@posting.google.c om...
I would like to select the top 10 record from a table? How can I do it?
In MS SQL, it's easy using select top 10 from table1. But in oracle database, I can't use top, anyone have any suggestions? Thanks!


I do not know SQL server, but I think that you want to do what is called Top
'N' Analysis. In Oracle you can do this through an inline view. I found the
explanation inserted at the bottom of this post on
http://www.orafaq.com/msgboard/serve...sages/7285.htm :

Best regards,

Jacob Grydholt Jensen

----

Posted by Barbara Boehmer (66.120.226.1) on April 05, 2003 at 02:13:35:

In Reply to: Is there any command similar to SQLSERVER TOP command in Oracle
posted by skrosuri on April 04, 2003 at 16:35:18:

In Oracle, top-n analysis is accomplished by first ordering the values in an
inner sub-query, then selecting the rows from an outer query. You can use
DESC in the order by clause to get the last row, rather than the first row.
Oracle does not guarantee the row returned until or unless an order by
clause has been applied.


SELECT *

FROM (SELECT column_names

FROM table_name

ORDER BY column_name DESC)

WHERE ROWNUM <= 1

/
Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Phil Powell | last post by:
Has anyone here ever done a case where you have a select multiple form element and you have to do both server-side and client-side validation? I am honestly not sure how to do it in Javascript (I...
4
by: Matt | last post by:
In ASP page, there is a "SELECT ALL" button, when user click it, it will select all checkboxes. I am not sure should I use client-side code to do that? the following is my approach but it didnt...
6
by: GSteven | last post by:
(as formerly posted to microsoft.public.access.forms with no result) I've created a continuous form which is based on a straightforward table (ex - customers - 100 records). On the form there is...
2
by: bhdvir | last post by:
Does anybody have any advice on selecting all records within a iif-statement? I have a form in which one has to state if all projects or just a selection of projects are to be used for a query....
0
by: mlke | last post by:
I would like to select the top 10 record from a table? How can I do it? In MS SQL, it's easy using select top 10 from table1. But in oracle database, I can't use top, anyone have any suggestions?...
11
by: bcurtu | last post by:
Hi, I have a BIIIIIG problem with the next query: cursor.execute(""" SELECT titem.object_id, titem.tag_id FROM tagging_taggeditem titem WHERE titem.object_id IN (%s) """,( eid_list))
41
bre1603
by: bre1603 | last post by:
I have a continuous form in Access 2007 called “Leadership Contact List.” It has a checkbox control for each record (bound to a field in the underlying table) that is used to email or create mailing...
0
by: Utku | last post by:
Is it possible to add "select all" and "select none" buttons to MultiChoiceDialog in wxPython?
7
Samishii23
by: Samishii23 | last post by:
I came across something in my code today that made me wonder if theres a way to basicly incorporate two statements into one using something like a "OR" logic. Basicly something like this: SELECT...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.