473,396 Members | 1,945 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Total Number of Employees hired in a certain year

Ok, first I'll admit I am working on a class. However I am stumped. I can get the following to work and it returns the number of employees hired in a specific year.

SELECT COUNT(hire_date) "1995"
FROM EMPLOYEES
WHERE hire_date LIKE '%95'
GROUP By hire_date;

But then if i try to add another year for it to look at, like this

SELECT COUNT(hire_date WHERE hire_date LIKE '%95') "1995", COUNT(hire_date WHERE hire_date LIKE '%96') "1996"
FROM EMPLOYEES
GROUP By hire_date;

I get the following error.

ERROR at line 1:
ORA-00907: missing right parenthesis

if I add a right parenthesis after '%95') and '%96') it give the same error.

What am I doing wrong? I'm trying to understand that when adding a multiple search what needs to be done to accomplish this.
Sep 14 '08 #1
4 13816
r035198x
13,262 8TB
Don't put a where clause inside the COUNT statement. That is illegal syntax.
Just add an OR clause to your original where clause.
Sep 15 '08 #2
I'm not sure I understand. I replaced WHERE with OR and received the same error as before.
Sep 16 '08 #3
Try this

SELECT COUNT(employee_no),hire_date FROM EMPLOYEE GROUP BY trunc(hire_date) HAVING hire_date IN ()

Thanks
Dilip
Sep 16 '08 #4
r035198x
13,262 8TB
I'm not sure I understand. I replaced WHERE with OR and received the same error as before.
Well I did say to add ( and not replace) to your original statement.
Sep 16 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: T-Narg | last post by:
I would like to produce the following output based on my XML file: My Album (2005) Elapsed Time (hh:mm:ss): 00:07:00 Song 1: title1 Length (hh:mm:ss): 00:02:30 Song 2: title2 Length...
1
by: Rajani | last post by:
Hello, I have a table(msaccess) with the structure... job_code text 6 style text 10 qty number fabrication text 65 ship_date date/time
3
by: Margaret | last post by:
I have a group of data that is hierarchical. Level N reports to level N-1 reports to.....Level 2 reports to level 1. I need to show this data on my Access report in such a manner: Level 1 --...
7
by: SueB | last post by:
Greetings. I have a report based on the following query (hang in there ... it's quite long): SELECT Year(.) AS Yr, tblEvents.eventID, tblEvents.eventname, tblEvents.eventhost,...
4
by: Shahar | last post by:
Hi I need to get a field name 'ID'(that is an auto-number field) right after I add a new row to table, it's work like that: myCommand.ExecuteNonQuery(); myCommand.CommandText = "SELECT...
3
by: Beowulf | last post by:
I have data coming from a telephony system that keeps track of when an employee makes a phone call to conduct a survey and which project number is being billed for the time the employee spends on...
2
by: OM | last post by:
I have two tables, one with categories in it, and only 3 records - Wages, Salary, Contract. I have a second table that records hours and numbers of employees in each category, per month. How do...
8
by: Petar | last post by:
I was just wondering. What if you have a 'Employees' class and you want to list all the employees. Currenlty i'm seeing to possibilities: - create a 'listAll' function inside the class which...
3
by: lizBeth | last post by:
Hi all, i seem to have gotten stuck on this coursework, i am unsure as to how to implement a method in the main class to calculate the sum of all employees monthly salaries. Everything...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.