Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 3.79 KB | None | 0 0
  1. SELECT tContactList.DaoID
  2.               ,CustomerID
  3.               ,FirstName
  4.               ,LastName
  5.               ,IndustryCode
  6.               ,IndustryDescription
  7.               ,SectorCode
  8.               ,SectorDescription
  9.               ,LoanCycle
  10.               ,coalesce(CustomerRole, '') as CustomerRole
  11.               ,Gender
  12.               ,Nationality
  13.               ,Age
  14.               ,MaritalStatus
  15.               ,ConfirmMobileNo
  16.               ,TelMobile
  17.               ,Address
  18.               ,BusinessAddress
  19.               ,City
  20.               ,GuarantorCustomerID
  21.               ,GuarantorFirstName
  22.               ,GuarantorLastName
  23.               ,GuarantorRelationship
  24.               ,GuarantorCity
  25.               ,GuarantorLGA
  26.               ,GuarantorSectorDesc
  27.               ,GuarantorHomeAddress
  28.               ,GuarantorBusinessAddress
  29.               ,GuarantorConfirmMobile
  30.               ,GuarantorLoanCycle
  31.               ,CustomerAccountCategory
  32.               ,CurrentAccountBalance
  33.               ,CurrentAccountCurrency
  34.               ,CurrentAccountNumber
  35.               ,CurrentAccountStatus
  36.               ,CurrentAccountOpeningDate
  37.               ,CurrAcctLastTrxn
  38.               ,CurrAcctLtxnDate
  39.               ,SavingsAccountCategory
  40.               ,SavingsAccountBalance
  41.               ,SavingsAccountCurrency
  42.               ,SavingsAccountNumber
  43.               ,SavingsAccountStatus
  44.               ,SavingsAccountOpeningDate
  45.               ,SavingsAcctLastTrxn
  46.               ,SavingsAcctLtxnDate
  47.               ,CustomerLAID1
  48.               ,LappBox
  49.               ,LAProductTypeDescription
  50.               ,LoanApplicationDate
  51.               ,LAStageNumber
  52.               ,LAStageDescription
  53.               ,LAStageDate
  54.               ,AmountRequested
  55.               ,LoanAmountCurrency
  56.               ,TermRequested
  57.               ,ApprovedAmount
  58.               ,ApprovedTerm
  59.               ,RejectReasonCode
  60.               ,RejectReasonDescription
  61.               ,LoanID
  62.               ,LoanProductName
  63.               ,DisbursedAmount
  64.               ,OutstandingAmount
  65.               ,PDOverdueAmount
  66.               ,LoanDuration
  67.               ,LoanMaturityDate
  68.               ,LoanInstallmentDate
  69.               ,InstallPayInd
  70.               ,Retard
  71.               ,RetardH
  72.               ,NextInstallAmount
  73.               ,SystemDate
  74.               ,ProspectClient
  75.               ,HomeLat
  76.               ,HomeLng
  77.               ,BusLat
  78.               ,BusLng
  79.               ,AdminFee
  80.               ,EarlyPayoff
  81.               ,tContactList.TimeDiff
  82.               ,TimeDiff2
  83.               ,TotVolOfDisbmin
  84.               ,OutstandingPr
  85.               ,ParOver0
  86.               ,ParOver30
  87.               ,ParOver90
  88.               ,ParOver0Percent
  89.               ,ParOver30Percent
  90.               ,ParOver90Percent
  91.               ,WriteOffLoanID
  92.               ,tParDetails.TimeDiff AS TimeDiffPar
  93.               ,stuff(((
  94.                 select '^' + gcl.HomeLat
  95.                 from [utnetCore].[Split](GuarantorCustomerID, '^') g
  96.                 join microCred.tContactList gCL on gCL.CustomerID = g.Value
  97.                 where gCL.HomeLat is not null
  98.                 for xml path(''), type).value('.', 'varchar(max)')), 1, 1, '') as GuarantorHomeLat
  99.               ,stuff(((
  100.                 select '^' + gcl.HomeLng
  101.                 from [utnetCore].[Split](GuarantorCustomerID, '^') g
  102.                 join microCred.tContactList gCL on gCL.CustomerID = g.Value
  103.                 where gCL.HomeLng is not null
  104.                 for xml path(''), type).value('.', 'varchar(max)')), 1, 1, '') as GuarantorHomeLng
  105.               ,stuff(((
  106.                 select '^' + gcl.BusLat
  107.                 from [utnetCore].[Split](GuarantorCustomerID, '^') g
  108.                 join microCred.tContactList gCL on gCL.CustomerID = g.Value
  109.                 where gCL.BusLat is not null
  110.                 for xml path(''), type).value('.', 'varchar(max)')), 1, 1, '') as GuarantorBusLat
  111.               ,stuff(((
  112.                 select '^' + gcl.BusLng
  113.                 from [utnetCore].[Split](GuarantorCustomerID, '^') g
  114.                 join microCred.tContactList gCL on gCL.CustomerID = g.Value
  115.                 where gCL.BusLng is not null
  116.                 for xml path(''), type).value('.', 'varchar(max)')), 1, 1, '') as GuarantorBusLng  
  117.         FROM microCred.tContactList LEFT JOIN microCred.tParDetails ON tContactList.DaoID= tParDetails.DaoID AND (tParDetails.DepartmentID = @DepartmentID OR @DepartmentID IS NULL)
  118.         WHERE tContactList.DaoID = 1163
  119.             AND (tContactList.DepartmentID = 'MicroCredAgents' OR 'MicroCredAgents' IS NULL)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement