0

Hi,

So i have a table called Resource in SQL in MS ACCESS,which has a field called Resource_Type which has values Permanent and Contract,
what i'm trying to do is get the count of the number of permanent and contract employees so as to display it's ratio.

This is my code,

Select
t1.CntOfResource_Type Where t1.Resource_Type='Permanent' As Perm ,
t1.CntOfResource_Type Where t1.Resource_Type='Contract' As Contract
From
(SELECT
Resource.Resource_Type,
Count(Resource.Resource_Type) AS CntOfResource_Type
FROM Resource
GROUP BY Resource.Resource_Type) AS t1;

When i try to run this code i get an error saying "syntax error (missing operator) in this expression "t1.CntOfResource_Type Where t1.Resource_Type='Permanent' As Perm , "

Does anyone know why?

Please help.

Edited by aruprongs

2
Contributors
1
Reply
15
Views
4 Years
Discussion Span
Last Post by Reverend Jim
0

I set up a sample table using the MS SQL NorthWind database as a start. The table has

ProductName
CategoryName

where there are multiple products which fall into one of 8 categories. The following query

select CategoryName,COUNT(CategoryName) as Frequency
  from temp
 group by categoryName

produced

CategoryName    Frequency
=========================
Beverages       12
Condiments      12
Confections     13
Dairy Products  10
Grains/Cereals   7
Meat/Poultry     6
Produce          5
Seafood         12

although I don't know how to get the ratio in the same query.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.