Sathya Narayan

Sathya Narayan

  • NA
  • 155
  • 65.1k

Query On Case Statement

Sep 19 2015 12:54 AM

hi ,
I have 2 tables tblCallActivity and tblTimesheet.In tblCallActitvity i have ID,CaseID,CallStatus,HOremark,UpdatedBy,UpdatedOn.In tblTimesheet i have TimesheetID,Timesheetin,Timesheetout,EEmployeeID,CaseId,Allocatedcallstatus and Allotedon.Here it should Allot Scheduler for Tbltimesheet caseid's and It should allot Normal Update for tblCallActivity caseid's here i am using CASE for this query but its not working it display Only Normal Update here is my query.

SELECT
CA.CaseID,
CA.UpdatedOn,

CASE WHEN
(
SELECT TimesheetId
FROM tblTimesheet
WHERE CaseId = CA.CaseID
) > 0 THEN ‘NormalUpdate’
ELSE ‘Scheduler’
END
FROM tblCallActivity CA where CallStatus=’ALLOTED’ Can any one plz help?


Answers (3)