1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Involved ADO Recordset filtering?

Discussion in 'Software Development' started by dekesc, Jun 26, 2012.

Thread Status:
Not open for further replies.
Advertisement
  1. dekesc

    dekesc Thread Starter

    Joined:
    Aug 4, 2010
    Messages:
    8
    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... 1. Using vbscript and asp 2. Databse = MS SQL (2008) 3. Table (care_Need_Entries) contains multiple rows of (varchar) columns: care_Need_Last_Name, care_Need_Date, and care_Need_Type (among other cols.). 4. 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"). 5. There must exist one "INITIAL" care_Need_Type for each care_Need_Last_Name. 6. There can exist none, one, or multiple "FOLLOWUP" care_Need_Type(s) for each care_Need_Last_Name. 7. An ADO Recordset has been opened and sorted based on "care_Need_Last_Name, care_Need_Date". 8. 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. 9. 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
     
  2. ckphilli

    ckphilli

    Joined:
    Apr 29, 2006
    Messages:
    4,384
    Have you re-read your post? It's a jumbled mess and I have no idea what you need help with.

    Use code tags to provide what you have so far. Highlight your code and click the hash in the editing toolbar.

    Code:
    Like so
     
  3. dekesc

    dekesc Thread Starter

    Joined:
    Aug 4, 2010
    Messages:
    8
    The reason for the scrambled post is b/c none of the browsers I have can't format the pages of this website. I have tried IE, Chrome and FireFox. The Error Console in FF says this: ----------------------------- Timestamp: 6/27/2012 9:37:51 AM Error: The stylesheet http://attach.tsgstatic.com/min/?ve...e.css,/tsg/styles/ClassicBlue/quicksearch.css was not loaded because its MIME type, "text/html", is not "text/css". Source File: http://forums.techguy.org/45-software-development/ Line: 0 -------------------------------------------
     
  4. Ent

    Ent Josiah Trusted Advisor

    Joined:
    Apr 11, 2009
    Messages:
    5,408
    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.
     
  5. ckphilli

    ckphilli

    Joined:
    Apr 29, 2006
    Messages:
    4,384
    Thanks Ent. :)

    dekesc,

    What do you have for your current select statement?
     
  6. ckphilli

    ckphilli

    Joined:
    Apr 29, 2006
    Messages:
    4,384
    This should get you started if you're stumped...:)

    Code:
    SELECT
         care_Need_Type,
         care_Need_Last_Name,
         MAX(care_Need_Date) AS "MostRecent"
    FROM care_Need_Entries
    GROUP BY   care_Need_Type, care_Need_Last_Name
     
  7. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1058712