mardi 19 juillet 2016

Check why record is returned twice in SQL

I have an inward_doc_tracking_hdr table with a total of 79 records.

But when I run the same thing in a stored procedure, I get a total of 80 records.

I checked the count and saw that one record count is 2.

FF

I want to know why the record is being returned twice.

Here is the query:

Select  
    UserName, Document_Type, 
    count(Doc_No) docno,
    Doc_No, No_Of_Days_Doc_Pending, UserEmail,
    RA1_Email  -- User table  
from 
    MainTempTable
group by 
    UserName, Document_Type, Doc_No, No_Of_Days_Doc_Pending, 
    UserEmail, RA1_Email, Doc_No

Aucun commentaire:

Enregistrer un commentaire