I've been trying to make a query that would return the total cost of several sub-departments as one department. I can make Access return the sum of the individual departments (named 233, 23A, 241 and so on), but it returns the total cost of the individual sub-department (ex. 23A), and not the cost of the entire department (23*). Im using a wildcard in the department name as there are quite a few subdepartments, so hardcoding each department name would be quite troublesome, but I cant get access to group the results by the first two chars in the departmentname only.
The query looks something like this:
SELECT ["DEPARTMENT"], SUM(["COST"])
FROM 2004_TABLE
GROUP BY ["DEPARTMENT"]
HAVING ((["DEPARTMENT"]) Like "23*") OR ((["DEPARTMENT"]) Like "24*");
I hope you can help me with this.
The query looks something like this:
SELECT ["DEPARTMENT"], SUM(["COST"])
FROM 2004_TABLE
GROUP BY ["DEPARTMENT"]
HAVING ((["DEPARTMENT"]) Like "23*") OR ((["DEPARTMENT"]) Like "24*");
I hope you can help me with this.