| Trusted Advisor with 4,875 posts. | | Join Date: Apr 2009 Location: United Kingdom Experience: Intermediate | |
Quote:
Originally Posted by dekesc I am not able to do the involved filtering of an ado recordset, as described below.
I have tried several approaches but no success. Here's the scenario: - Using vbscript and asp
- Databse = MS SQL (2008)
- Table (care_Need_Entries) contains multiple rows of (varchar) columns: care_Need_Last_Name, care_Need_Date, and care_Need_Type (among other cols.).
- Each care_Need_Last_Name can have one or more occurrences with care_Need_Type = "INITIAL" and/or "FOLLOWUP" along with having a unique varchar date (care_Need_Date = "i.e, 10/14/2012".
- There must exist one "INITIAL" care_Need_Type for each care_Need_Last_Name.
- There can exist none, one, or multiple "FOLLOWUP" care_Need_Type(s) for each care_Need_Last_Name.
- An ADO Recordset has been opened and sorted based on "care_Need_Last_Name, care_Need_Date".
- From this recordset, I need to filter (keep) only 'the most recent date' row for each care_Need_Last_Name, whether it be just the "INITIAL" or the last "FOLLOWUP" care_Need_Type.
- From the resultant filter in #7 I then will geneate a report (not a part of this issue).
Example db data...
care_Need_Type care_Need_Last_Name care_Need_Date
INITIAL Jones 5/12/2012
INITIAL Bell 6/14/2012
FOLLOWUP Bell 6/15/2012
INITIAL SPARKS 6/16/2012
FOLLOWUP Bell 6/16/2012
FOLLOWUP Jones 5/17/2012
INITIAL Reese 6/20/2012
The result needed is...
FOLLOWUP Jones 5/17/2012
FOLLOWUP Bell 6/16/2012
INITIAL SPARKS 6/16/2012
INITIAL Reese 6/20/2012
I hope I have explained things but if not, please let me know what else is needed. Thanks. dekesc | That's a bit easier to read now. 
I would suggest that you take the browser question to the comments and suggestions subforum if it persists. The site works fine for me in Firefox, IE, Opera, and Google Chrome, but sometimes you do get corrupted scripts and the like. Before you do so, try just clearing your browser cache and cookies before restarting your browser.
__________________ I don't read minds. Please help everyone by answering any questions and reporting on the results of any suggestions.
Our Library of Knowledge is provided for your use. Can you help to improve it? |