No Results from Query - SQL Server 2012

  • I have written a relatively simple query but it generating zero results. I am not getting any error message, just no results. On the messages tab it says '0 rows affected'.

    Here is the query:

    use CLL_LIVE

    go

    SELECT Em.Empno

    ,RTRIM (em.GivenName)

    ,RTRIM (em.Surname)

    ,em.Position

    ,em.EMail

    ,p.Rate

    FROM Employee_Master AS em

    JOINPayDetail AS p

    onem.Empno = p.Empno

    WHERE em.EmployStatus <> 11

    It is pretty basic, Employee Id, Name, Position, Email and pay rate. As long as there is no join and the "rate" is not asked for it generates a list of all employees. Once I join the paydetail table, I get no results.

  • what datatype is "em.EmployStatus "?

    ________________________________________________________________
    you can lead a user to data....but you cannot make them think
    and remember....every day is a school day

  • et2brutuss (8/11/2014)


    I have written a relatively simple query but it generating zero results. I am not getting any error message, just no results. On the messages tab it says '0 rows affected'.

    Here is the query:

    use CLL_LIVE

    go

    SELECT Em.Empno

    ,RTRIM (em.GivenName)

    ,RTRIM (em.Surname)

    ,em.Position

    ,em.EMail

    ,p.Rate

    FROM Employee_Master AS em

    JOINPayDetail AS p

    onem.Empno = p.Empno

    WHERE em.EmployStatus <> 11

    It is pretty basic, Employee Id, Name, Position, Email and pay rate. As long as there is no join and the "rate" is not asked for it generates a list of all employees. Once I join the paydetail table, I get no results.

    Query the PayDetail table and verify that the Empno values in this table exists in the Employee_Master table.

  • The whole query has char as the data type with the exception of 'rate' which is decimal

  • That resolves the problem, the values I am looking for don't exist in the PayDetail table.. Thank you for your assistance.

Viewing 5 posts - 1 through 4 (of 4 total)

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