Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT tContactList.DaoID
- ,CustomerID
- ,FirstName
- ,LastName
- ,IndustryCode
- ,IndustryDescription
- ,SectorCode
- ,SectorDescription
- ,LoanCycle
- ,coalesce(CustomerRole, '') as CustomerRole
- ,Gender
- ,Nationality
- ,Age
- ,MaritalStatus
- ,ConfirmMobileNo
- ,TelMobile
- ,Address
- ,BusinessAddress
- ,City
- ,GuarantorCustomerID
- ,GuarantorFirstName
- ,GuarantorLastName
- ,GuarantorRelationship
- ,GuarantorCity
- ,GuarantorLGA
- ,GuarantorSectorDesc
- ,GuarantorHomeAddress
- ,GuarantorBusinessAddress
- ,GuarantorConfirmMobile
- ,GuarantorLoanCycle
- ,CustomerAccountCategory
- ,CurrentAccountBalance
- ,CurrentAccountCurrency
- ,CurrentAccountNumber
- ,CurrentAccountStatus
- ,CurrentAccountOpeningDate
- ,CurrAcctLastTrxn
- ,CurrAcctLtxnDate
- ,SavingsAccountCategory
- ,SavingsAccountBalance
- ,SavingsAccountCurrency
- ,SavingsAccountNumber
- ,SavingsAccountStatus
- ,SavingsAccountOpeningDate
- ,SavingsAcctLastTrxn
- ,SavingsAcctLtxnDate
- ,CustomerLAID1
- ,LappBox
- ,LAProductTypeDescription
- ,LoanApplicationDate
- ,LAStageNumber
- ,LAStageDescription
- ,LAStageDate
- ,AmountRequested
- ,LoanAmountCurrency
- ,TermRequested
- ,ApprovedAmount
- ,ApprovedTerm
- ,RejectReasonCode
- ,RejectReasonDescription
- ,LoanID
- ,LoanProductName
- ,DisbursedAmount
- ,OutstandingAmount
- ,PDOverdueAmount
- ,LoanDuration
- ,LoanMaturityDate
- ,LoanInstallmentDate
- ,InstallPayInd
- ,Retard
- ,RetardH
- ,NextInstallAmount
- ,SystemDate
- ,ProspectClient
- ,HomeLat
- ,HomeLng
- ,BusLat
- ,BusLng
- ,AdminFee
- ,EarlyPayoff
- ,tContactList.TimeDiff
- ,TimeDiff2
- ,TotVolOfDisbmin
- ,OutstandingPr
- ,ParOver0
- ,ParOver30
- ,ParOver90
- ,ParOver0Percent
- ,ParOver30Percent
- ,ParOver90Percent
- ,WriteOffLoanID
- ,tParDetails.TimeDiff AS TimeDiffPar
- ,stuff(((
- select '^' + gcl.HomeLat
- from [utnetCore].[Split](GuarantorCustomerID, '^') g
- join microCred.tContactList gCL on gCL.CustomerID = g.Value
- where gCL.HomeLat is not null
- for xml path(''), type).value('.', 'varchar(max)')), 1, 1, '') as GuarantorHomeLat
- ,stuff(((
- select '^' + gcl.HomeLng
- from [utnetCore].[Split](GuarantorCustomerID, '^') g
- join microCred.tContactList gCL on gCL.CustomerID = g.Value
- where gCL.HomeLng is not null
- for xml path(''), type).value('.', 'varchar(max)')), 1, 1, '') as GuarantorHomeLng
- ,stuff(((
- select '^' + gcl.BusLat
- from [utnetCore].[Split](GuarantorCustomerID, '^') g
- join microCred.tContactList gCL on gCL.CustomerID = g.Value
- where gCL.BusLat is not null
- for xml path(''), type).value('.', 'varchar(max)')), 1, 1, '') as GuarantorBusLat
- ,stuff(((
- select '^' + gcl.BusLng
- from [utnetCore].[Split](GuarantorCustomerID, '^') g
- join microCred.tContactList gCL on gCL.CustomerID = g.Value
- where gCL.BusLng is not null
- for xml path(''), type).value('.', 'varchar(max)')), 1, 1, '') as GuarantorBusLng
- FROM microCred.tContactList LEFT JOIN microCred.tParDetails ON tContactList.DaoID= tParDetails.DaoID AND (tParDetails.DepartmentID = @DepartmentID OR @DepartmentID IS NULL)
- WHERE tContactList.DaoID = 1163
- AND (tContactList.DepartmentID = 'MicroCredAgents' OR 'MicroCredAgents' IS NULL)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement