here's the query:
SELECT [Lab Occurrence Form].[1 0 Preanalytical (Before Testing)],Count([Lab Occurrence Form].[1 0 Preanalytical (Before Testing)]) AS [CountOf1 0 Preanalytical (Before Testing)]
FROM [Lab Occurrence Form]
WHERE ((([Lab Occurrence Form].[Occurrence Date]) Between [Forms]![Meeting_Reasons_Frequency]![Text4] And [Forms]![Meeting_Reasons_Frequency]![Text2]))
GROUP BY [Lab Occurrence Form].[1 0 Preanalytical (Before Testing)]
HAVING Count([Lab Occurrence Form].[1 0 Preanalytical (Before Testing)])<>0
UNION SELECT [Lab Occurrence Form].[2 0 Analytical (Testing Phase)], Count([Lab Occurrence Form].[2 0 Analytical (Testing Phase)]) AS [CountOf2 0 Analytical (Testing Phase)]
FROM [Lab Occurrence Form]
WHERE ((([Lab Occurrence Form].[Occurrence Date]) Between [Forms]![Meeting_Reasons_Frequency]![Text4] And [Forms]![Meeting_Reasons_Frequency]![Text2]))
GROUP BY [Lab Occurrence Form].[2 0 Analytical (Testing Phase)]
HAVING Count([Lab Occurrence Form].[2 0 Analytical (Testing Phase)])<>0
union
SELECT [Lab Occurrence Form].[3 0 Postanalytical ( After Testing)], Count([Lab Occurrence Form].[3 0 Postanalytical ( After Testing)]) AS [CountOf3 0 Postanalytical ( After Testing)]
FROM [Lab Occurrence Form]
WHERE ((([Lab Occurrence Form].[Occurrence Date]) Between [Forms]![Meeting_Reasons_Frequency]![Text4] And [Forms]![Meeting_Reasons_Frequency]![Text2]))
GROUP BY [Lab Occurrence Form].[3 0 Postanalytical ( After Testing)]
HAVING Count([Lab Occurrence Form].[3 0 Postanalytical ( After Testing)])<>0
UNION SELECT [Lab Occurrence Form].[4 0 Other], Count([Lab Occurrence Form].[4 0 Other]) AS [CountOf4 0 Other]
FROM [Lab Occurrence Form]
WHERE ((([Lab Occurrence Form].[Occurrence Date]) Between [Forms]![Meeting_Reasons_Frequency]![Text4] And [Forms]![Meeting_Reasons_Frequency]![Text2]))
GROUP BY [Lab Occurrence Form].[4 0 Other]
HAVING Count([Lab Occurrence Form].[4 0 Other])<>0
ORDER BY 1, 2;
it generates something that looks like this:
1 0 Preanalytical (Before Testing) CountOf1 0 Preanalytical (Before Testing)
1.11 Other-reject per practice 1
1.11 Other-req form marked Validity Only 1
1.11 Other-req form only, no specimen 3
1.11 Other-spec sent by mistake 1
1.11 Other-Test Req marked validity only 1
1.11 Other-validity only 3
1.11 Other-validity only-TP updated 1
1.3 QNS-Quantity Not Sufficient 103
1.4 Tests Missed/ Wrong Test Ordered 1
1.4 Tests Missed/ Wrong Test Ordered & 1.11 Other-data entry-dup tests 2
1.4 Tests Missed/Wrong Test Ordered 3
1.5 Patient Info. entered Incorrectly 1
1.6 Test Requisition Missing 22
1.6 Test Requisition Missing & 1.7 Specimen Lost 2
1.6 Test Requisition Missing-CSRM 1
1.8 Specimen not handled/processed correctly & 1.10 Operator Error(?) 1
1.8 Specimen not handled/processed correctly,1.10 Operator Error & 1.11 Other-no THC INSD recovery 1
1.9 QNS- Specimen Spilled in transit 88
2.1 Delay in Testing/resulting 1
2.1 Delay in Testing/resulting & 2.22 Instrument Problem 4
i want to group and sum the result by number
instead of having a bunch of 1.11 Others, i want to sum them up and get:
1.11 11
1.3 103
1.4 4
so i guess what i need to do is select the first 4 characters of the first column , and group it by the first column, and do a sum on the second column? please help me with this select statement