I'm having an issue getting distinct records from the database.
What I need is to sum a few columns that are selected based on a range of data and I need it to be distinct on a single column. What happens is, I get a row for each of the values in the range.
Here is the SQL statement I am using:
SELECT F_DETAIL.FD_UNIT, Sum(F_DETAIL.FD_TOT_MILES) AS SumOfFD_TOT_MILES, Sum(F_DETAIL.FD_TOLL_MILES) AS SumOfFD_TOLL_MILES, Sum(F_DETAIL.FD_FUEL) AS SumOfFD_FUEL
FROM F_DETAIL
GROUP BY F_DETAIL.FD_UNIT, F_DETAIL.FD_MONTH, F_DETAIL.FD_YEAR
HAVING (((F_DETAIL.FD_MONTH)>=7 And (F_DETAIL.FD_MONTH)<=9) AND ((F_DETAIL.FD_YEAR)=6))
ORDER BY F_DETAIL.FD_UNIT;
I need the recordset to sum and return a single row for each FD_UNIT number, not each for for FD_MONTH = 7, 8, or 9.
Is there anyway I can return that type of recordset?
What I need is to sum a few columns that are selected based on a range of data and I need it to be distinct on a single column. What happens is, I get a row for each of the values in the range.
Here is the SQL statement I am using:
SELECT F_DETAIL.FD_UNIT, Sum(F_DETAIL.FD_TOT_MILES) AS SumOfFD_TOT_MILES, Sum(F_DETAIL.FD_TOLL_MILES) AS SumOfFD_TOLL_MILES, Sum(F_DETAIL.FD_FUEL) AS SumOfFD_FUEL
FROM F_DETAIL
GROUP BY F_DETAIL.FD_UNIT, F_DETAIL.FD_MONTH, F_DETAIL.FD_YEAR
HAVING (((F_DETAIL.FD_MONTH)>=7 And (F_DETAIL.FD_MONTH)<=9) AND ((F_DETAIL.FD_YEAR)=6))
ORDER BY F_DETAIL.FD_UNIT;
I need the recordset to sum and return a single row for each FD_UNIT number, not each for for FD_MONTH = 7, 8, or 9.
Is there anyway I can return that type of recordset?