R
Ragnar Midtskogen
Hello,
I have a table of diagnoses where one field contains the specimen ID. It is
an ODBC linked table to SQL Server.
There may be more than one records for a specimen, where one record is
supposed to have a Boolean field called Final is set to True.
For some unknown reason some specimens none of the records have this field
set to True.
I need to identify these specimens and have trouble getting the results I am
looking for.
I have written the following queries, the second selecting the results from
the first, in order to select the records with False final diagnosis:
Query 1: SpecimenGroups:
SELECT Diagnoses.SpecimenID AS SpmID, First(Diagnoses.DateReviewed) AS
DateRev, First(Diagnoses.ReviewerInitials) AS RevInitl,
Count(Diagnoses.FinalDiagnosis) AS FinDiagn, Count(Diagnoses.FirstDiagnosis)
AS FirstDiagn
FROM Diagnoses
GROUP BY Diagnoses.SpecimenID;
Query 2: MissingFinals:
SELECT SpecimenGroups.AccNum, SpecimenGroups.SpmCount,
SpecimenGroups.DateRev, SpecimenGroups.RevInt, SpecimenGroups.FinDiag,
SpecimenGroups.FirstDiag
FROM SpecimenGroups
WHERE (((SpecimenGroups.FinDiag)=0));
This gives me all the specimens I am looking for, I think.
Since I need to show all the records for each specimen I had planned to join
the second query with the table Diagnoses.
However, this gives me an error message that the ODBC call failed, the Sum
aggregate function can not take a bit data type as argument.
HELP!
Any help would be appreciated, there must be a simpler way of doing this!
Ragnar
I have a table of diagnoses where one field contains the specimen ID. It is
an ODBC linked table to SQL Server.
There may be more than one records for a specimen, where one record is
supposed to have a Boolean field called Final is set to True.
For some unknown reason some specimens none of the records have this field
set to True.
I need to identify these specimens and have trouble getting the results I am
looking for.
I have written the following queries, the second selecting the results from
the first, in order to select the records with False final diagnosis:
Query 1: SpecimenGroups:
SELECT Diagnoses.SpecimenID AS SpmID, First(Diagnoses.DateReviewed) AS
DateRev, First(Diagnoses.ReviewerInitials) AS RevInitl,
Count(Diagnoses.FinalDiagnosis) AS FinDiagn, Count(Diagnoses.FirstDiagnosis)
AS FirstDiagn
FROM Diagnoses
GROUP BY Diagnoses.SpecimenID;
Query 2: MissingFinals:
SELECT SpecimenGroups.AccNum, SpecimenGroups.SpmCount,
SpecimenGroups.DateRev, SpecimenGroups.RevInt, SpecimenGroups.FinDiag,
SpecimenGroups.FirstDiag
FROM SpecimenGroups
WHERE (((SpecimenGroups.FinDiag)=0));
This gives me all the specimens I am looking for, I think.
Since I need to show all the records for each specimen I had planned to join
the second query with the table Diagnoses.
However, this gives me an error message that the ODBC call failed, the Sum
aggregate function can not take a bit data type as argument.
HELP!
Any help would be appreciated, there must be a simpler way of doing this!
Ragnar