Jump to content


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.


Database Help

  • Please log in to reply
2 replies to this topic

#1 mr phil

mr phil

  • Members
  • 13 posts
  • Location:South Yorkshire
  • Local time:10:33 AM

Posted 14 June 2007 - 05:43 AM

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

BC AdBot (Login to Remove)


#2 Nikas


  • Members
  • 650 posts
  • Gender:Male
  • Location:Singapore
  • Local time:06:33 PM

Posted 14 June 2007 - 11:54 AM

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 ErrorMessage


  • Members
  • 19 posts
  • Location:Devon
  • Local time:11:33 AM

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.
Knowledge is knowing a tomato is a fruit; Wisdom is not putting it in a fruit salad

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users