Syntax

  • I am not sure whether this is correct or not ...

    Can anyone tell me.

    I am trying to take a count where both the values are "Yes" and Available.

    IsnUll(CAST(Case when Emp_FullTime = 'Yes' and Emp_Status = 'Available' then 1 else 0 end AS VARCHAR(10)),0)as EmpCode

  • something like this would give you the count that meets your condition, as well as the total count for a total

    does this help?

    SELECT

    SUM(CASE

    WHEN Emp_FullTime = 'Yes' AND Emp_Status = 'Available'

    THEN 1

    ELSE 0

    END) AS EmpCodeCount,

    COUNT(*) AS TotalCount

    FROM YourTable

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply