gRegulator
Technical User
Hi,
I have created a Union Query which selects data from my main table 'tbl_offenders'. This returns all data that is stored in the table according to the following fields:
SELECT 'Probation' AS ConditionDescription, Male, Female
FROM tbl_Offenders
WHERE [Probation] = True
UNION ALL SELECT 'Conditional Sentence', Male, Female
FROM tbl_Offenders
WHERE [Conditional Sentence] = True
UNION ALL SELECT 'Fine Option Program', Male, Female
FROM tbl_Offenders
WHERE [Fine Option Program] = True
UNION ALL SELECT 'Community Service', Male, Female
FROM tbl_Offenders
WHERE [Community Service Order] = True;
A part of my table tbl_offenders also includes a start date for each of these types of dispositions. Those fields as titled [Probation Start], [Conditional Sentence Start], [Fine Option Program Start], [Community Service Order Start].
I then have made a summary query which tabulates the data for me. The SQL coding for that is as follows:
SELECT qry_offenders.ConditionDescription AS Disposition, -Sum([Male]) AS [Male Clients], -Sum([Female]) AS [Female Clients]
FROM qry_offenders
GROUP BY qry_offenders.ConditionDescription;
I would like the option of filtering the data by way of a parameter that includes the start date and only by the dates specified. Does anyone have an idea of how to include the dates in this query?
Thanks in advance!
I have created a Union Query which selects data from my main table 'tbl_offenders'. This returns all data that is stored in the table according to the following fields:
SELECT 'Probation' AS ConditionDescription, Male, Female
FROM tbl_Offenders
WHERE [Probation] = True
UNION ALL SELECT 'Conditional Sentence', Male, Female
FROM tbl_Offenders
WHERE [Conditional Sentence] = True
UNION ALL SELECT 'Fine Option Program', Male, Female
FROM tbl_Offenders
WHERE [Fine Option Program] = True
UNION ALL SELECT 'Community Service', Male, Female
FROM tbl_Offenders
WHERE [Community Service Order] = True;
A part of my table tbl_offenders also includes a start date for each of these types of dispositions. Those fields as titled [Probation Start], [Conditional Sentence Start], [Fine Option Program Start], [Community Service Order Start].
I then have made a summary query which tabulates the data for me. The SQL coding for that is as follows:
SELECT qry_offenders.ConditionDescription AS Disposition, -Sum([Male]) AS [Male Clients], -Sum([Female]) AS [Female Clients]
FROM qry_offenders
GROUP BY qry_offenders.ConditionDescription;
I would like the option of filtering the data by way of a parameter that includes the start date and only by the dates specified. Does anyone have an idea of how to include the dates in this query?
Thanks in advance!