select count(*) from table_name not showing desired result

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ashish Pandey
    New Member
    • Feb 2012
    • 2

    select count(*) from table_name not showing desired result

    hello..
    i have a simple table ATTENDANCE with following columns and value..

    create table ATTENDANCE
    (EMP_ID VARCHAR(20),
    STATUS VARCHAR(10),
    DATE DATETIME);

    EMP_ID STATUS DATE
    A1 PRESENT 2012-02-13 00:00:00.000
    A2 PRESENT 2012-02-13 00:00:00.000

    now my problem is when i m firing the query as:
    select count(*) from ATTENDANCE where emp_id='A1' AND STATUS='PRESENT ';
    it is showing "1" as answer and this is correct.

    but when when i m firing the query as:
    select count(*) from ATTENDANCE where emp_id='A2' AND STATUS='PRESENT ';
    it is showing "0" as answer and this is NOT correct, IT SHOULD SHOW "1".

    can anyone plz tell where i m wrong..

    i m using sqlserver 2005 and windows 7 as OS..


    DO REPLY SOON..
    THANK U..
  • Ashish Pandey
    New Member
    • Feb 2012
    • 2

    #2
    got the ans..
    just a silly mistake of extra space..
    thank u..

    Comment

    Working...