🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.interbase.sql
6 messages
6 total messages Started by Tracy McClarnon Fri, 22 Nov 2002 15:29
First Row Only
#11343
Author: Tracy McClarnon
Date: Fri, 22 Nov 2002 15:29
8 lines
1302 bytes
Hello,

I'm sure this has been asked before, but I am unable to locate it here in
the newsgroups. How can I retrieve only the first row in a select staement?

Thank you,

Tracy McClarnon
Re: First Row Only
#11344
Author: Jeff Overcash (TeamB)
Date: Fri, 22 Nov 2002 15:50
22 lines
1761 bytes
IB 6.5 and higher just use ROWS 1.  Earlier versions you can either write a SP
that exits after the first row is returned.

Tracy McClarnon wrote:
> 
> Hello,
> 
> I'm sure this has been asked before, but I am unable to locate it here in
> the newsgroups. How can I retrieve only the first row in a select staement?
> 
> Thank you,
> 
> Tracy McClarnon

-- 
Jeff Overcash (TeamB) 
      (Please do not email me directly unless  asked. Thank You) 
Maybe it was infatuation or the thrill of the chase.
Maybe you were always beyond my reach and my heart was playing safe.
But was that love in your eye I saw or the reflection of mine?
Give me time, won't you give me that time!
Welcome back to the circus.            (Fish)
Re: First Row Only
#11345
Author: Craig Stuntz TeamB
Date: Fri, 22 Nov 2002 17:05
15 lines
1611 bytes
In article <3DDE525C.7A554A48@mindspring.com>, jeffovercash@mindspring.com 
says...
> IB 6.5 and higher just use ROWS 1.  Earlier versions you can either write a SP
> that exits after the first row is returned.
> 
	If you want one row only in earlier versions you can use MAX on the 
column which determines the order.

	-Craig

-- 
Craig Stuntz [TeamB] � Vertex Systems Corp. � Columbus, OH
Delphi/InterBase Weblog : http://delphi.weblogs.com
InterBase Perf. Monitor : http://delphi.weblogs.com/IBPerformanceMonitor
InterBase PLANalyzer 1.1: http://delphi.weblogs.com/IBPLANalyzer
Re: First Row Only
#11399
Author: The DeerBear
Date: Tue, 26 Nov 2002 12:29
12 lines
1304 bytes
Craig Stuntz [TeamB] wrote:

> If you want one row only in earlier versions you can use MAX on the
> column which determines the order.

May you please expand this explaination with a simple example?

TIA

> -Craig

Andrew
Re: First Row Only
#11401
Author: Rafael Vacas
Date: Tue, 26 Nov 2002 13:17
25 lines
1615 bytes
select * from my_table
where my_field = (select max(my_field) from my_table)

... where my_field is the "column which determines the order".

Rafael
A Coru�a

"The DeerBear" <rainaple@tin.it> escribi� en el mensaje
news:3de3690d@newsgroups.borland.com...
> Craig Stuntz [TeamB] wrote:
>
> > If you want one row only in earlier versions you can use MAX on the
> > column which determines the order.
>
> May you please expand this explaination with a simple example?
>
> TIA
>
> > -Craig
>
> Andrew
>
>
Re: First Row Only
#11400
Author: The DeerBear
Date: Tue, 26 Nov 2002 13:23
16 lines
1418 bytes
Rafael Vacas wrote:
> select * from my_table
> where my_field = (select max(my_field) from my_table)
>
> ... where my_field is the "column which determines the order".

So, it's like.. CREATE INDEX "my_Field" DESCENDING

and then using that to issue a select like u typed?

TIA

> Rafael
> A Coru�a

Andrew
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads