Sheryl,
I would add the unique ClientID field to your query and save it. Then create a new query with SQL of:
SELECT ClientID, Client_Last_Name, Client_First_Name, CaseID, Drug_Date, CRet_Amount, Status, Start_Date
FROM [YourQueryName]
WHERE DrugDate IN
(SELECT TOP 5 DrugDate
FROM [YourQueryName] Q
WHERE Q.ClientID = [YourQueryName].ClientID
ORDER BY DrugDate DESC)
And, remember to include previous messages in your post so we don't have to flip back and forth between old messages.
Duane Hookom MVP
MS Access
Date: Wed, 19 Nov 2014 14:13:00 -0800
Subject: [MS_AccessPros] Re: Help with Date Query
OK. I tried, but I failed. This is the basic query I have. Now, I have to add the information about being able to select the top 5 of each client's drug date (Drug_History.Drug_Date). This is way over my head, so if you can help, I'd really appreciate it.
I would add the unique ClientID field to your query and save it. Then create a new query with SQL of:
SELECT ClientID, Client_Last_Name, Client_First_Name, CaseID, Drug_Date, CRet_Amount, Status, Start_Date
FROM [YourQueryName]
WHERE DrugDate IN
(SELECT TOP 5 DrugDate
FROM [YourQueryName] Q
WHERE Q.ClientID = [YourQueryName].ClientID
ORDER BY DrugDate DESC)
And, remember to include previous messages in your post so we don't have to flip back and forth between old messages.
Duane Hookom MVP
MS Access
Date: Wed, 19 Nov 2014 14:13:00 -0800
Subject: [MS_AccessPros] Re: Help with Date Query
OK. I tried, but I failed. This is the basic query I have. Now, I have to add the information about being able to select the top 5 of each client's drug date (Drug_History.Drug_Date). This is way over my head, so if you can help, I'd really appreciate it.
Thanks.
SELECT Client_Case_Information.Client_Last_Name, Client_Case_Information.Client_First_Name, Client_Case_Information.CaseID, Drug_History.Drug_Date, Drug_History.CRet_Amount, Client_Case_Information.Status, Case_Color_Codes.Start_Date
FROM (Client_Case_Information INNER JOIN Drug_History ON Client_Case_Information.CaseID = Drug_History.CaseID) INNER JOIN Case_Color_Codes ON Client_Case_Information.CaseID = Case_Color_Codes.CaseID
WHERE (((Client_Case_Information.Status)="PA and MP Signed") AND ((Case_Color_Codes.Start_Date) Is Not Null))
ORDER BY Client_Case_Information.Client_Last_Name, Drug_History.Drug_Date;
Sheryl Jones
__._,_.___
Posted by: Duane Hookom <duanehookom@hotmail.com>
| Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (4) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar