473,394 Members | 1,674 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Select only a portion of the resulting rows

Table Information:
I have these columns say ACCOUNT_ID, ACCOUNT_CODE and SEQ_NUM (and few more needless to mention). For every account ID and Code combination there can be multiple entries in the table, with different sequence numbers. The first entry for the account ID and Code combination starts with 98 and for every additional entry the sequence number is decreased. Effectively I'll have sequence numbers ranging from 98 thru 1 (normally i'll not have more than 50 entries for each acct id and code combo) for every new entry of account id and code. This way the entry with the least seq_num is the most recent.

I need to write query that should give me the following result:
If there are more than 10 entries for the account id and code combination, then i need the oldest records after the recent 10 entries. For an example if there are 30 entries for an account (recent seq_num would be 69) id and code combo, i need the records with seq_num greater than 78.


I'll require this query to run on mainframe z/OS and the DB2 version is 8.1. When researching for this I found out the row_number() function, but it doesnt work with v8.1. Is there any other function equivalent to row_number in v8.1 or if someone could provide a solution to this problem it'd be great. Also I'd prefer a query rather than stored procedures or UDF.
Dec 9 '09 #1
0 1514

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Vagabond Software | last post by:
I posted this problem earlier and now have more information. I use the DataTable Select method to get find the most recent "LastModified" date in a table of similarly named files. I then use the...
1
by: Eddie | last post by:
I have a DataTable.Select() statement with a DateTime field that is being compared to a Date: Dim drCal as DataRow() = tblCal.Select("CalendarItemDate ='12/1/2003'", "CalendarItemDate",...
1
by: Diffident | last post by:
Hello All, I am trying to filter rows in a datatable based on filtercriteria and sortcriteria using the datatable.select() method. I am encountering a strange behavior in this process. Here is...
6
by: jjturon | last post by:
Can anyone help me?? I am trying to pass a Select Query variable to a table using Dlookup and return the value to same select query but to another field. Ex. SalesManID ...
8
by: Bosconian | last post by:
I have two multiple select inputs. Initially the first contains a bunch of items and the second is empty. Using a common method, I move items back and forth by double clicking on them. This...
11
by: MurdockSE | last post by:
Greetings. My Situation: // I have an .xml file that I am reading into a dataset in the following code - DataSet ds = new DataSet("MyDataset"); ds.ReadXml(@"c:\data\"+cmyxmlfilename);
11
by: Douglas | last post by:
Hi Im not an SQL n00b, but I'm no SQL guru... I'd like to work out the SQL code required to achieve the following goal in pseudocode: Grap a record Using info from that record, add (the...
2
by: Wolfgang | last post by:
Hi, is there a possibility to change the size of the select-dropdown-box ? I predefine the length of the option-area with 10 inside HTML as follows: <select class="select250"...
1
by: wallic | last post by:
I am using the code below to update my "loctable". When I run just the select portion of the query, it returns the rows that are specified... but when I run the update query it says all "row(s)...
5
bilibytes
by: bilibytes | last post by:
Hi, i am having big headaches in trying to find out how to perform a very very simple query. having a table like this one: +--------------+----------+---------+ | name | object1 |...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.