[Info-ingres] Select last 10 rows from the table
pwhite peercore
pwhite at peercore.com.au
Sat Nov 7 00:41:29 UTC 2015
Hi EJ Boy,
It is a good question to question direct to the Ingres forums. Here are a couple of good places to visit.
http://lists.planetingres.org/mailman/listinfo/info-ingres
http://community.actian.com/forum/
This is my attempt:
* select count(*) from customer\g
Executing . . .
│ 3867│
* select cust_code from customer order by cust_code offset 3857\g
Executing . . .
│cust_cod│
│YESNADEX│
│YINBRAV0│
│YONDEVT0│
│YORRICV0│
│YOTFOOV0│
│YUMBRUV0│
│YUMCHIEX│
│ZHECHIEX│
│ZHKMELEX│
│ZHOZHOEX│
(10 rows)
I agree with Bodo's simple approach. Which ever you choose, be sure to test for table scans and locking issues. Run debug: qep, io trace and lock trace for your selected approach.
Paul
From: openroad-users at googlegroups.com On Behalf Of Bodo Bergmann
Sent: Friday, 6 November 2015 6:48 PM
To: EJ-Boy Perez; OpenROAD Users Mailing List
Subject: [openroad-users] RE: Select last 10 rows from the table
How about selecting the first 10 rows from the result set sorted in descending order,
then sorting those 10 rows ascending in the OpenROAD client using array.Sort() method?
Something like this (arr is an array of a user class for your result data):
EXECUTE IMMEDIATE 'SELECT FIRST 10 or_date, col1, col2 FROM yourtable ORDER BY 1 DESC'
INTO :arr[i].or_date, :arr[i].col1, :arr[i].col2
BEGIN
i=i+1;
END;
COMMIT;
arr.Sort(or_date = AS_ASC);
HTH.
Regards,
Bodo.
--
Bodo Bergmann
Senior Software Engineer
Actian | Engineering
Phone: +49.6103.3033.734
www.actian.com
GESELLSCHAFTSANGABEN: Geschäftsführer: Steven R. Springsteel, Stephen Mark Padgett, Markus Bockle
Sitz der Gesellschaft: Hamburg| Handelsregister: Amtsgericht Hamburg | HRB 135991| USt-IdNr: DE252449897
From: EJ-Boy Perez [mailto:ecperezjr31 at gmail.com]
Sent: Freitag, 6. November 2015 03:57
To: OpenROAD Users Mailing List <openroad-users at googlegroups.com>
Cc: Bodo Bergmann <Bodo.Bergmann at actian.com>
Subject: Select last 10 rows from the table
Hi everyone1
May I ask assistance on how to select the last 10 rows from the table. table sorted in ascending order based on its column name or_date.
thank you in advance.
--
You received this message because you are subscribed to the Google Groups "OpenROAD Users Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openroad-users+unsubscribe at googlegroups.com.
To post to this group, send email to openroad-users at googlegroups.com.
Visit this group at http://groups.google.com/group/openroad-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/openroad-users/CO1PR06MB314F3A13D84338653234FED93280%40CO1PR06MB314.namprd06.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.
More information about the Info-ingres
mailing list