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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.