Results 1 to 3 of 3

Thread: integer count

  1. #1
    Join Date
    May 2004

    Unanswered: integer count

    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:
    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!

  2. #2
    Join Date
    Jun 2003
    West Palm Beach, FL


    Did you try:
    SELECT COUNT(*) AS TotalPoints
    FROM TblEmpAttendance
    WHERE Value IN ('1', '2', '3', '7')
        And TblEmployee.EmployeeID=TblEmpAttendance.EmployeeID;
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  3. #3
    Join Date
    May 2004
    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!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts