Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> How to put a TOP 1 in a select

How to put a TOP 1 in a select

From: Teresita Castro <Teresita.Castro_at_s-martmx.com>
Date: Mon, 09 Jun 2003 18:36:05 -0700
Message-ID: <F001.005AE0B7.20030609171923@fatcity.com>

Hi!!
I was working with SQL Server 2000, and now the company decided to change to Oracle. So I don't know much about Oracle, I am just reading a book and try to find information on the net.
I am trying to do the next query, but I guess Oracle did not have the function TOP. How can I do a TOP 1 in Oracle?
 

<FONT face="Courier New" color=#0000ff 
POINT-SIZE="9">select<FONT face="Courier New" color=#000000 
POINT-SIZE="9"> TOP 1 ITEM, TRANS_DATE <FONT face="Courier New" 
color=#0000ff POINT-SIZE="9">from<FONT face="Courier New" color=#000000
POINT-SIZE="9"> ICTRANS <FONT face="Courier New" color=#0000ff 
POINT-SIZE="9">where<FONT face="Courier New" color=#000000 
POINT-SIZE="9"> 

  (COMPANY =

2000)
 <FONT
face="Courier New" color=#0000ff POINT-SIZE="9">AND<FONT 
face="Courier New" color=#000000 POINT-SIZE="9"> (TRANS_DATE <FONT 
face="Courier New" color=#0000ff POINT-SIZE="9">BETWEEN<FONT 
face="Courier New" color=#000000 POINT-SIZE="9">  (CURRENT_DATE-14) 
AND<FONT
face="Courier New" color=#000000 POINT-SIZE="9"> CURRENT_DATE)
 
 <FONT
face="Courier New" color=#0000ff POINT-SIZE="9">AND<FONT 
face="Courier New" color=#000000 POINT-SIZE="9"> (DOC_TYPE = <FONT 
face="Courier New" color=#ff0000 POINT-SIZE="9">'IS'<FONT 
face="Courier New" color=#000000 POINT-SIZE="9">) 

 <FONT
face="Courier New" color=#0000ff POINT-SIZE="9">AND<FONT 
face="Courier New" color=#000000 POINT-SIZE="9"> (REASON_CODE = <FONT 
face="Courier New" color=#ff0000 POINT-SIZE="9">'VTCL'<FONT 
face="Courier New" color=#000000 POINT-SIZE="9">) 

 <FONT

face="Courier New" color=#0000ff POINT-SIZE="9">AND<FONT face="Courier New" color=#000000 POINT-SIZE="9"> (SUBSTR(ITEM, 2, 2) = '57'<FONT
face="Courier New" color=#000000 POINT-SIZE="9">) <FONT
face="Courier New" color=#0000ff POINT-SIZE="9">order<FONT 
face="Courier New" color=#000000 POINT-SIZE="9"> <FONT face="Courier New" 
color=#0000ff POINT-SIZE="9">by<FONT face="Courier New" color=#000000 
POINT-SIZE="9"> QUANTITY
 

I hope you undestand my
English. Received on Mon Jun 09 2003 - 20:36:05 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US