Im not at all familiar with sql programming text but i need to do something I cant find an example of.  Im using the sql query inside of an access 2003 database.  Basicall I have two tables.  One that hold all the employees personal informaton AS WELL AS Total Days Worked AND TotalPoints.
A day worked is represented by a "w" form within my vb program.
I used to sql code:
SELECT COUNT(*) AS TotalDW
FROM TblEmpAttendance
WHERE Value="w" And TblEmployee.EmployeeID=TblEmpAttendance.EmployeeID  ;
To get the "w" total or count in this case.
--This seems to work without a problem please let me know if you see a problem with it.
--Now on to  my bigger problem.
The second table has 3 fields-- EmployeeID, Date,Value
The date comes from my vb program(a calendar with textfields to hold values)
However-- to limit the code I use in my vb program I wanted to take a point total for all points from the 2nd tbl
In vb I can use --IF Isnumeric --But I have no clue how to do it woth SQL code!!
A Point Value can only be 1 of 4 values(a 1,2,3 or a 7)
But how do I rewrite the below code(if below code is even close!) to count all of the numeric values for the field "Value" when not every entry for "Value is a numeric entry?
SELECT COUNT(*) AS TotalPoints
FROM TblEmpAttendance
WHERE Value= '1 or 2 or 3 or 7' And TblEmployee.EmployeeID=TblEmpAttendance.EmployeeID  ;
Hopefully I explained sufficiently..Thanks In advance!Did you try:
SELECT COUNT(*) AS TotalPoints
FROM TblEmpAttendance
WHERE Value IN ('1', '2', '3', '7')
    And TblEmployee.EmployeeID=TblEmpAttendance.EmployeeID  ;
 ;)|||Nope but I will now..Thanks Much! it is highly appreciated..Just tried it...I only have 4 sample employees to check it with but it seems to work...
Many thanks!!!
 
No comments:
Post a Comment