Description
Query to extract details for claims raised in customer portal
Query :
Query to extract details for claims raised in customer portal
Query :
Select TicketId,DepartmentName,convert(char,convert(datetime,A.CreatedOn at time zone 'UTC' at time zone 'Central Standard Time (Mexico)'),120)ClaimCreatedOn,/*A.CreatedByUserId,*/F.Username CreatedbyUser,
convert(char,convert(datetime,A.ModifiedOn at time zone 'UTC' at time zone 'Central Standard Time (Mexico)'),120)ClaimModifiedOn,
convert(char(10),D.SurveyDate,126)'SurveyDate',A.SessionUid,D.ProgramItemId,
StatusId,E.DisplayValue ClaimStatus,/*Count (TicketId) Tickets_Count,*/B.Code,B.Name,B.LocationClusterId,C.Name,SurveyClaimId,A.Notes,ResponseNotes,SubmissionDate,IsScoreApproved,
IsScoreUpdated,/*TopicName,SubTopic,*/RejectedReason,A.ClaimTopicId,TerritoryType,A.*
from SurveyClaim A with (nolock)
inner join location B with (nolock) on A.LocationId=B.LocationId --and B.Code = '10034165'/*'001002003'*/
inner join LocationCluster C with (nolock) on B.LocationClusterId=C.LocationClusterId --and B.LocationClusterId = 2
inner join Survey D with (nolock) on A.SessionUid=D.SessionUid
inner join vwSurveyStatusList E with (nolock) on A.StatusId=E.LookupId
inner join Security_User F with (nolock) on A.CreatedByUserId=F.UserId
--inner join ClaimTopic G with (nolock) on A.ClaimTopicId=G.ClaimTopicId
where /*D.SurveyDate between '2023-08-01' and '2023-09-26' and StatusId = 0 and
convert(char,convert(datetime,A.CreatedOn at time zone 'UTC' at time zone 'Central Standard Time (Mexico)'),120) > '2023-09-01' and ResponseNotes is not NULL*/-- and A.SessionUid = '10594b03-803b-4d5b-a041-6dee4f380b19'--and A.createdbyuserid <> A.modifiedbyuserid--and B.LocationClusterId = 2 --AND A.ResponseNotes IS NOT NULL
--group by D.SurveyDate,A.SessionUid,ProgramItemId,StatusId,E.DisplayValue,TicketId,B.Code,B.Name,B.LocationClusterId,C.Name,/*SurveyClaimId,*/A.Notes,ResponseNotes,/*SubmissionDate,IsScoreApproved,
--IsScoreUpdated,*/A.CreatedOn,A.CreatedByUserId,A.ModifiedOn,A.ClaimTopicId,/*TopicName,SubTopic,*/RejectedReason,TerritoryType
--having count (A.TicketId)>1
A.SessionUid = '80e43410-a101-4683-8ec7-f676e51ba897'
--and TerritoryType is not null
--and responsenotes like '%portal.vision%'
/*TicketId IN (
'SLZ-DQHPC-631'
)*//* SurveyClaimId IN ('47917')*/
--B.Code = '500587474'
--group by convert(char(10),D.SurveyDate,126),A.SessionUid--,D.ProgramItemId,StatusId,E.DisplayValue
order by A.CreatedOn asc,A.Sessionuid
--------------------------------------------------