🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.sql
Article #1012

first skip and indexes?

#1012
From: Mark Horrocks
Date: Sun, 04 Mar 2007 08:01
24 lines
2079 bytes
My problem is simple but I can't find a solution. I have a table with a 
primary integer key set by a generator.

The next field is a name field, say customer name. I want to return records 
10 to 19 of the customer table sorted alphabetically by customer name. The 
natural order of the records is the generated customer id number which is 
the order in which the records were inserted. I assume that select first 10 
skip 10 * Order By Customer_Name will select the second 20 records in their 
insert order THEN sort the result vy Customer Name. However, what I want is 
to presort the records alpabetically on customer name and THEN select the 
second 20 records.

In other words, I if I enter the following records A1, A2, A3, A4, A5, A6, 
A7, B1, B2, B3, B4, B5, B6, B7, C1, C2, C3, C4, C5, ......Zn then I enter 
B8, the natural storage order is that order. I want the result set to 
include B8 as part of the second set of 10 records.

I think the solution is to create and index on customer name and use PLAN to 
select, (PLAN (Customers INDEX (IDX1)),  however, I always get a message 
saying that there is no table or alias named IDX1.

What is the correct solution?

Mark Horrocks
Technical Details
Message-ID: <45ea7cb5@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 114a0e,8fe340ef4fc0c174,start
X-Google-Attributes: gid114a0e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Mark Horrocks" <markhorrocks_at_yahoo_dot_com>
Newsgroups: borland.public.interbase.sql
Subject: first skip and indexes?
Date: Sun, 4 Mar 2007 16:01:08 +0800
Lines: 27
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3028
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028
NNTP-Posting-Host: 202.69.189.151
Message-ID: <45ea7cb5@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1172995253 202.69.189.151 (4 Mar 2007 00:00:53 -0800)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail