Newbie: Counting of groups of items??

  • Thread starter Thread starter ButBi
  • Start date Start date
B

ButBi

Hi,
I need urget help to make analysing. I've an inventory database. I have
a table with txtEquipmentName and intAge:

Machine 1 2 (years)
Machine 2 4 (years)
Machine 3 1 (years)
Machine 4 7 (years)
Machine 5 10 (years)
.....

I want to have a query to show:

x Machines <3 years
y Machines >3 and <5 years
z Machines > 5 years

How can I do that? Thanks for any help.
 
SELECT Abs(Sum(intAge<3)) as CountLT3
, Abs(Sum(intAge>3 and IntAge<=5)) as Count3to5
, Abs(Sum(intAge>5)) as CountGT5
FROM YourInventoryTable
 
One more question: How can I "transpose" this query to draw a pie
chart:

MachineGroups Number

CountLT3 x
Count3to5 y
CountGT5 z

Thanks!
 
Back
Top