Adding two queries

sullyman

Registered User.
Local time
Today, 07:33
Joined
Oct 24, 2009
Messages
47
I have two queries which i would like to divide one from another. What is the Sql statement to do same please
 
Please help as this step will have my project 90% finished

I have managed to add the three queries together to give me the required values below that i need but when i try to add the two values in the Total column, the values are not adding. Any ideas?


Also, how would i go about diving employees by completed.
Would it be Total:([EmployeeNo]' / '[Attended])


total Employees = 100
Course Completed = 25
Course Name = Course 1

SELECT A.EmployeeNo, B.Attended, C.Course, 'Total:([EmployeeNo]' + '[Attended])' AS Total
FROM (SELECT COUNT(Employee) AS EmployeeNo
FROM dbo.Employees
GROUP BY Unit
HAVING (Unit = '1')) AS A CROSS JOIN
(SELECT COUNT(EmployeeID) AS Attended
FROM dbo.Course_History
WHERE (Courseid = '1') AND (UnitID = '1')) AS B CROSS JOIN
(SELECT Courses AS Course
FROM dbo.Safety_Courses
WHERE (Courses = 'Course 1')) AS C
 
I can't understand what your calculations are trying to achieve but observed the following.

SELECT A.EmployeeNo, B.Attended, C.Course, 'Total[EmployeeNo]' + '[Attended])' AS Total
This is not adding two numbers but concatenating two strings. Drop the quote marks.

Total[EmployeeNo]' / '[Attended])
This expression has no meaning.

Why are you using strings for the Courseid and UnitID?
Why are you using 'Course 1' in the Courses field?
 

Users who are viewing this thread

Back
Top Bottom