Hi there,
i'm new to databased so i apologise if this is really easy.
i have a database where i have a department in 1 field, member of staff in another and a grade in the 3rd (ranging from 1-4). How do i get a query to add the amount of 1's then 2's etc per department?
Thanks for any help
Phil
Page 1 of 1
Database Help Count fields with a criteria
#2
Posted 14 June 2007 - 11:54 AM
SELECT COUNT(grade)
FROM Department
WHERE Department = HR (for e.g.) AND grade = 1
I don't really get what you mean, so this query actually count the number of grade = 1 in HR department.
If I got you wrong, let me know and I can change accordingly.
FROM Department
WHERE Department = HR (for e.g.) AND grade = 1
I don't really get what you mean, so this query actually count the number of grade = 1 in HR department.
If I got you wrong, let me know and I can change accordingly.
#3
Posted 12 September 2007 - 11:04 AM
could try
select department,grade, count(member of staff)
from tablename
group by department,grade
will give you result set like this (for example)
department grade count
hr 1 1
hr 2 2
hr 3 44
You'll need to get the column and table names right.
Good luck.
select department,grade, count(member of staff)
from tablename
group by department,grade
will give you result set like this (for example)
department grade count
hr 1 1
hr 2 2
hr 3 44
You'll need to get the column and table names right.
Good luck.
Knowledge is knowing a tomato is a fruit; Wisdom is not putting it in a fruit salad
Share this topic:
Page 1 of 1

Help

Back to top









