Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > Oracle
|
Oracle General Oracle database discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Oracle section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 27th, 2004, 01:55 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 196
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to jmss66
Default Select Statement

Can someone please help me with my SQL Statement. What I am trying to accomplish is to just get one record out of 10 in a recordset. I have the following SQL query but it is giving me an error message stating that from keyword is not found where expected. Somebody please help me figure it out.

select top 1 * from dbo.disburse_schedule where person_id = 12076 order by start_date DESC

Thanks,
Judy

 
Old May 27th, 2004, 02:31 PM
Authorized User
 
Join Date: Apr 2004
Posts: 70
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Oracle does not support the TOP N syntax-- that's a SQL Server extension. Unless you have a "dbo" schema in your Oracle database with a disburse_schedule table, you don't want to qualify your Oracle table name with "dbo". You can do something like

Code:
SELECT *
  FROM (SELECT *
          FROM disburse_schedule
         WHERE person_id = 12076
         ORDER BY start_date DESC)
 WHERE rownum < 2

Justin
Distributed Database Consulting, Inc.
http://www.ddbcinc.com/askDDBC





Similar Threads
Thread Thread Starter Forum Replies Last Post
select statement ??? RinoDM SQL Server 2000 7 June 19th, 2008 08:40 AM
select Statement gregalb SQL Server 2000 3 January 15th, 2008 12:00 AM
select statement help... RinoDM SQL Server 2000 13 January 10th, 2008 08:34 PM
Select from another select statement to a repeater simsen ASP.NET 2.0 Professional 0 May 2nd, 2007 04:34 PM
select statement help RinoDM SQL Server 2000 2 January 16th, 2007 11:35 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.