If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
...how to filter/query recods
i have a table with 20,000 records. one column includes names. another column
includes multiple dates the person visited a doctor, and another column includes dates the person visited a hospital. i am only interested in the last date the person visited a doctor and the last date the person visited a hospital (if they had any visits to the doctor or hospital). I am also interested in members who have had no visits to the doctor or hospital. any suggestions on how i can filter the data to only return these records? thanks Name Date Visited Doctor Date Visited Hospital Nigel 01/01/1980 012/31/1995 05/20/1999 06/06/2005 03//02/2004 05/06/2004 For example, I only want to return Nigel, 03/02/2004 (Date Visited Doctor), and 06/06/2005 (Date Visited Hospital). thank you. i really appreciate any help you can offer. |
#2
|
|||
|
|||
SELECT Name, max([Visited Doctor]) AS Last_Visit_Date, "Doctor Visit" AS
Visit_Type FROM TableName GROUP BY Name, "Doctor Visit" UNION SELECT Name, max([Visited Hospital]), "Hospital Visit" FROM TableName GROUP BY Name, "Hospital Visit" "Uwiprof" wrote in message ... i have a table with 20,000 records. one column includes names. another column includes multiple dates the person visited a doctor, and another column includes dates the person visited a hospital. i am only interested in the last date the person visited a doctor and the last date the person visited a hospital (if they had any visits to the doctor or hospital). I am also interested in members who have had no visits to the doctor or hospital. any suggestions on how i can filter the data to only return these records? thanks Name Date Visited Doctor Date Visited Hospital Nigel 01/01/1980 012/31/1995 05/20/1999 06/06/2005 03//02/2004 05/06/2004 For example, I only want to return Nigel, 03/02/2004 (Date Visited Doctor), and 06/06/2005 (Date Visited Hospital). thank you. i really appreciate any help you can offer. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
...how to filter/query records | Uwiprof | New Users | 1 | August 31st, 2005 12:21 AM |
Filter/Query According to a List of Criteria | DianaY | Running & Setting Up Queries | 3 | July 7th, 2005 09:25 PM |
Grabbing recods based on date and shift values | Jay | Worksheet Functions | 1 | February 25th, 2005 02:42 PM |
Excel Filter/Query | proben930 | General Discussion | 2 | September 23rd, 2004 10:11 PM |