glthornton
Programmer
Hi everyone,
I'm trying to use an SQL Expression field to determine the number of ApptID's where it finds an Action code of 15 and an Action code of 0 on the same day. Example of the data: (tblAltApptHistory)
ApptID Date ActionID
123 10/01/2005 15
123 10/01/2005 0
124 10/01/2005 0
125 10/02/2005 0
125 10/02/2005 15
This is what I have for a query right now:
SELECT DISTINCT `tblAltApptHistory`.`AppID`
FROM `tblAltApptHistory`
WHERE `tblAltApptHistory`.`Action`= 15 AND `tblAltApptHistory`.`AppID`=
(SELECT DISTINCT `tblAltApptHistory`.`AppID` FROM `tblAltApptHistory` WHERE `tblAltApptHistory`.`Action`= 0)
But when I try to check the query, I get a "DAO Error Code: 0xd1a Description at most one record can be returned by the subquery"
If this is not the correct approach to take to get my expected results, does anyone have any recommendations?
What I'd like to get back from the query is:
ApptID
123
125
Thank you!!
I'm trying to use an SQL Expression field to determine the number of ApptID's where it finds an Action code of 15 and an Action code of 0 on the same day. Example of the data: (tblAltApptHistory)
ApptID Date ActionID
123 10/01/2005 15
123 10/01/2005 0
124 10/01/2005 0
125 10/02/2005 0
125 10/02/2005 15
This is what I have for a query right now:
SELECT DISTINCT `tblAltApptHistory`.`AppID`
FROM `tblAltApptHistory`
WHERE `tblAltApptHistory`.`Action`= 15 AND `tblAltApptHistory`.`AppID`=
(SELECT DISTINCT `tblAltApptHistory`.`AppID` FROM `tblAltApptHistory` WHERE `tblAltApptHistory`.`Action`= 0)
But when I try to check the query, I get a "DAO Error Code: 0xd1a Description at most one record can be returned by the subquery"
If this is not the correct approach to take to get my expected results, does anyone have any recommendations?
What I'd like to get back from the query is:
ApptID
123
125
Thank you!!