Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: [Info-ingres] Select last 10 rows from the table

78 views
Skip to first unread message

pwhite peercore

unread,
Nov 6, 2015, 7:41:58 PM11/6/15
to EJ-Boy Perez, Ingres and related product discussion forum, openroa...@googlegroups.com
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: openroa...@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:ecper...@gmail.com]
Sent: Freitag, 6. November 2015 03:57
To: OpenROAD Users Mailing List <openroa...@googlegroups.com>
Cc: Bodo Bergmann <Bodo.B...@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-user...@googlegroups.com.
To post to this group, send email to openroa...@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.

_______________________________________________
Info-ingres mailing list
Info-...@lists.planetingres.org
http://lists.planetingres.org/mailman/listinfo/info-ingres
0 new messages