Guest User

Untitled

a guest
Dec 4th, 2017
843
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.61 KB | None | 0 0
  1. SELECT l.*, c.*
  2. FROM loans l
  3. LEFT JOIN clients c ON l.client_id = c.client_id
  4. LEFT JOIN clients_coms com ON l.client_id = com.client_id
  5. LEFT JOIN clients_addresses ad ON l.client_id = ad.client_id
  6. LEFT JOIN clients_emp emp ON l.client_id = emp.client_id
  7. LEFT JOIN clients_banks bank ON l.client_id = bank.client_id
  8. WHERE com.value = 'llyamjamie@aol.com'
  9. AND bank.sort_code = '309374'
  10. GROUP BY l.loan_id
  11.  
  12. SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
  13. SET time_zone = "+00:00";
  14.  
  15. CREATE TABLE `clients` (
  16. `client_id` int(11) NOT NULL,
  17. `username` varchar(150) NOT NULL,
  18. `password` varchar(32) NOT NULL,
  19. `clientref` varchar(20) NOT NULL,
  20. `title_id` int(11) DEFAULT NULL,
  21. `fname` varchar(100) DEFAULT NULL,
  22. `mname` varchar(100) DEFAULT NULL,
  23. `lname` varchar(100) DEFAULT NULL,
  24. `dob` date DEFAULT NULL,
  25. `dependants` int(3) DEFAULT NULL,
  26. `marital_id` int(11) DEFAULT NULL,
  27. `status_difficulty_id` int(11) NOT NULL DEFAULT '1',
  28. `blacklisted` tinyint(1) NOT NULL DEFAULT '0',
  29. `market_consent` tinyint(1) NOT NULL DEFAULT '0',
  30. `market_broker` tinyint(1) NOT NULL DEFAULT '0',
  31. `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP
  32. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  33.  
  34. INSERT INTO `clients` (`client_id`, `username`, `password`, `clientref`, `title_id`, `fname`, `mname`, `lname`, `dob`, `dependants`, `marital_id`, `status_difficulty_id`, `blacklisted`, `market_consent`, `market_broker`, `created`) VALUES
  35. (12516, 'tony@strat55yinternet.com', 'e8fec09af5441b940b200a0df09039db', 'Yamantaka108!', 1, 'Anthony', NULL, 'Simmons', '1961-11-26', 1, 1, 1, 0, 1, 1, '2017-02-27 01:08:26'),
  36. (12517, 'trythis@ungdfgdfg.co.uk', '0cef1fb10f60529028a71f58e54ed07b', 'Password1!', 1, 'testme', NULL, 'testmeagain', '1983-09-19', 0, 3, 1, 0, 1, 0, '2017-04-21 08:59:16'),
  37. (12518, 'teddy.highlander@stradfgdfnternet.com', 'e8fec09af5441b940b200a0df09039db', 'Yamantaka108!', 1, 'Teddy', NULL, 'Highlander', '1990-01-01', 2, 2, 1, 0, 1, 0, '2017-04-21 09:37:08'),
  38. (12519, 'terry.v@stradfgyinternet.com', 'e8fec09af5441b940b200a0df09039db', 'Yamantaka108!', 1, 'Terry', NULL, 'Vanerslat', '1990-01-01', 2, 2, 1, 0, 1, 1, '2017-04-21 09:42:53'),
  39. (12520, 'testybanker@stratedfgets.com', 'e8fec09af5441b940b200a0df09039db', 'Yamantaka108!', 1, 'Testy', NULL, 'Banker', '1990-01-01', 1, 1, 1, 0, 0, 1, '2017-04-21 19:17:29'),
  40. (12521, 'teddy.kruger@stradfgrnet.com', 'e8fec09af5441b940b200a0df09039db', 'Yamantaka108!', 1, 'teddy', NULL, 'kruger', '1995-07-12', 1, 1, 1, 0, 1, 1, '2017-05-01 08:23:04'),
  41. (12522, 'test123@test.com', '0cef1fb10f60529028a71f58e54ed07b', 'Password1!', 1, 'wptest', NULL, 'wptest', '1990-01-01', 0, 3, 1, 0, 0, 0, '2017-05-02 16:51:06'),
  42. (12523, 'test123@undfggk.co.uk', '0cef1fb10f60529028a71f58e54ed07b', 'Password1!', 1, 'wptest', NULL, 'wptest', '1980-01-01', 0, 2, 1, 0, 0, 1, '2017-05-08 09:46:24'),
  43. (12524, '43201at78285n316xl@udgfdfgdf.co.uk', '16125873728ecaa5663548acd8708dc1', 'Digitalis1!', 1, 'wptester', NULL, 'wptester', '1980-01-01', 0, 3, 1, 0, 1, 1, '2017-05-08 10:09:48'),
  44. (12525, 'test@test.com', '7b91953d6f7ace4bd58f5e27b92129b2', 'M4ll1ng$', 2, 'test', NULL, 'test', '1988-03-15', 1, 1, 1, 0, 1, 0, '2017-05-12 10:20:18'),
  45. (12526, 'terry@terry.com', 'e8fec09af5441b940b200a0df09039db', 'Yamantaka108!', 1, 'Terry', NULL, 'Vanguard', '1998-02-03', 2, 2, 1, 0, 1, 0, '2017-05-12 21:51:34'),
  46. (12527, 'tony@tester.com', 'f44de07db359724e8be77b679d648261', 'C&e3zCyl', 2, 'Tony', NULL, 'Tester', '1998-06-16', 1, 1, 1, 0, 0, 0, '2017-05-12 22:01:57'),
  47. (12528, 'terry@tester.com', 'e8fec09af5441b940b200a0df09039db', 'Yamantaka108!', 2, 'Terry', NULL, 'Tester', '1998-10-20', 1, 2, 1, 0, 0, 1, '2017-05-12 22:08:22'),
  48. (12529, 'info@myemail.com', 'e8fec09af5441b940b200a0df09039db', 'Yamantaka108!', 1, 'Anthony', NULL, 'Simmons', '1980-02-05', 2, 2, 1, 0, 0, 1, '2017-05-12 23:14:28'),
  49. (12530, 'sgmudfgrray@lidfgve.co.uk', '8889c4ff30a036e69af92c00e7381f9b', 'Trepalle$666', 1, 'Steve', NULL, 'Murray', '1966-02-07', 2, 2, 1, 0, 0, 0, '2017-05-16 10:05:04'),
  50. (12533, 'mbucgper@undfgck.co.uk', '7b91953d6f7ace4bd58f5e27b92129b2', 'M4ll1ng$', 1, 'Matt', NULL, 'Smith', '1970-01-27', 0, 1, 1, 0, 0, 0, '2017-05-17 10:55:23'),
  51. (12534, '1@unerteruck.co.uk', '7b91953d6f7ace4bd58f5e27b92129b2', 'M4ll1ng$', 1, 'Jacob', NULL, 'Matthews', '1960-05-31', 0, 1, 1, 0, 0, 0, '2017-05-17 15:17:56'),
  52. (12535, '2@uncrteterk.co.uk', '7b91953d6f7ace4bd58f5e27b92129b2', 'M4ll1ng$', 4, 'Jess', NULL, 'Brown', '1960-06-09', 0, 2, 1, 0, 0, 0, '2017-05-17 15:45:02'),
  53. (12536, 'test@straerttester.com', 'e8fec09af5441b940b200a0df09039db', 'Yamantaka108!', 1, 'Test', NULL, 'Testerly', '1997-09-22', 1, 1, 1, 0, 1, 0, '2017-05-24 05:13:46'),
  54. (12539, 'test@test34324.com', '5db95e2186901ec55d959bc0db190bc8', 'RfsBMZ_w', 1, 'Matt', NULL, 'smith', '1960-02-02', 4, 1, 1, 0, 0, 0, '2017-09-25 07:33:57'),
  55. (12540, 'test@gmail.com', 'a42316cf2aedfa853893628eb74bcfb4', 'PF8r!W&R', 4, 'Ema', NULL, 'Gupta', '1920-02-03', 1, 1, 1, 0, 1, 0, '2017-10-09 11:20:00'),
  56. (12542, 'rgupta@unertetck.com', 'f925916e2754e5e03f75dd58a5733251', 'Test@123', 3, 'Ruchi ', NULL, 'Gupta', '1983-01-01', 0, 1, 1, 0, 1, 0, '2017-10-09 13:09:49');
  57.  
  58.  
  59. CREATE TABLE `clients_addresses` (
  60. `client_address_id` int(11) NOT NULL,
  61. `client_id` int(11) NOT NULL,
  62. `house_number` varchar(20) DEFAULT NULL,
  63. `house_name` varchar(50) DEFAULT NULL,
  64. `street` varchar(100) DEFAULT NULL,
  65. `city` varchar(50) DEFAULT NULL,
  66. `county` varchar(70) DEFAULT NULL,
  67. `postcode` varchar(10) DEFAULT NULL,
  68. `home_status_id` int(11) DEFAULT NULL,
  69. `movein_date` date DEFAULT NULL,
  70. `current` tinyint(1) NOT NULL DEFAULT '1',
  71. `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  72. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  73.  
  74.  
  75. INSERT INTO `clients_addresses` (`client_address_id`, `client_id`, `house_number`, `house_name`, `street`, `city`, `county`, `postcode`, `home_status_id`, `movein_date`, `current`, `created`) VALUES
  76. (590, 12516, '1', 'Paddock House', 'Merrow Street', 'Guildford', NULL, 'GU47AG', 1, '2000-02-01', 1, '2017-02-27 01:09:17'),
  77. (591, 12519, '45', 'willow tree', 'smith street', 'southfields', NULL, 'Sw185dj', 1, '2000-01-01', 1, '2017-04-21 09:43:44'),
  78. (592, 12520, '44', 'Patcick house', 'pastel St', 'Guildford', NULL, 'Gu47ag', 1, '1998-01-01', 1, '2017-04-21 19:18:16'),
  79. (593, 12521, '1', 'Haybarn House', 'Guildford Rd', 'Guildford', NULL, 'GU12QL', 1, '1998-01-01', 1, '2017-05-01 08:23:43'),
  80. (594, 12522, '221b Baker Street', '', 'Baker Street', 'bromley', NULL, 'NW1 6XE', 1, '2005-12-01', 1, '2017-05-02 16:52:46'),
  81. (595, 12523, '5-6', '', 'Matthews Street', 'Rugby', NULL, 'CV21 3BY', 1, '2001-01-01', 1, '2017-05-08 09:47:58'),
  82. (596, 12524, '21', '', 'Henry Street', 'Stratford', NULL, 'CV37 6QW', 1, '2000-12-01', 1, '2017-05-08 10:11:16'),
  83. (597, 12525, '707', '', 'Churchill Way', 'Westerham', NULL, 'TN16 3BN', 1, '2008-04-01', 1, '2017-05-12 10:21:00'),
  84. (598, 12528, '58', '', 'High Path Road', 'Guildford', NULL, 'GU1 2QL', 1, '2017-01-01', 1, '2017-05-12 22:11:46'),
  85. (599, 12528, '', '2 Paddock House', 'Merrow Street', 'Guildford', NULL, 'GU4 7AG', 2, '2016-01-01', 0, '2017-05-12 22:11:46'),
  86. (600, 12529, '3', 'Britannia House', 'Caerphilly Business Park', 'Caerphilly', NULL, 'CF83 3GG', 2, '2012-02-01', 1, '2017-05-12 23:14:46'),
  87. (601, 12530, '1', 'Cronks Farm', 'Hampstead Lane', 'Maidstone', NULL, 'ME185HN', 1, '2004-04-01', 1, '2017-05-16 10:06:27'),
  88. (604, 12542, '707', '', 'Biggnin Hill', 'westerham', NULL, 'TN16 3BN', 1, '2011-01-01', 1, '2017-10-09 13:10:42');
  89.  
  90.  
  91. CREATE TABLE `clients_banks` (
  92. `client_bank_id` int(11) NOT NULL,
  93. `client_id` int(11) NOT NULL,
  94. `bank_id` int(11) DEFAULT NULL,
  95. `sort_code` varchar(6) DEFAULT NULL,
  96. `account` varchar(8) DEFAULT NULL,
  97. `bank_name` varchar(70) DEFAULT NULL COMMENT 'Returned by AFD API',
  98. `active` tinyint(1) NOT NULL DEFAULT '1',
  99. `created` timestamp NULL DEFAULT CURRENT_TIMESTAMP
  100. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  101.  
  102.  
  103. INSERT INTO `clients_banks` (`client_bank_id`, `client_id`, `bank_id`, `sort_code`, `account`, `bank_name`, `active`, `created`) VALUES
  104. (544, 12516, 3, '309374', '03522844', 'Lloyds Bank PLC', 0, '2017-02-27 01:11:47'),
  105. (551, 12516, 3, '301641', '60722260', 'Lloyds International', 1, '2017-02-28 06:16:41'),
  106. (552, 12516, 3, '309384', '03544844', 'Lloyds Bank PLC', 0, '2017-02-28 06:17:57'),
  107. (553, 12519, 3, '804378', '03555844', 'Lloyds Bank PLC', 1, '2017-04-21 09:52:12'),
  108. (554, 12520, 3, '309355', '03555844', 'Lloyds Bank PLC', 1, '2017-04-21 19:21:09'),
  109. (555, 12521, 3, '802374', '03566844', 'Lloyds Bank PLC', 1, '2017-05-01 08:37:04'),
  110. (556, 12523, 3, '602044', '00000000', 'Nat West Bank PLC', 1, '2017-05-08 09:54:26'),
  111. (557, 12524, 3, '902046', '00000000', 'Nat West Bank PLC', 1, '2017-05-08 10:15:03'),
  112. (558, 12525, 5, '602044', '00000000', 'Nat West Bank PLC', 1, '2017-05-12 11:42:42'),
  113. (559, 12528, 3, '309674', '03577844', 'Lloyds Bank PLC', 1, '2017-05-12 22:15:12'),
  114. (560, 12529, 3, '399379', '03588844', 'Lloyds Bank PLC', 0, '2017-05-12 23:18:40'),
  115. (561, 12529, 3, '909374', '03511844', 'Lloyds Bank PLC', 1, '2017-05-12 23:25:53');
  116.  
  117.  
  118. CREATE TABLE `clients_coms` (
  119. `client_coms_id` int(11) NOT NULL,
  120. `client_id` int(11) NOT NULL,
  121. `coms_id` int(11) NOT NULL,
  122. `value` varchar(150) NOT NULL,
  123. `active` tinyint(1) NOT NULL DEFAULT '1',
  124. `main` tinyint(1) NOT NULL DEFAULT '1',
  125. `user_id` int(11) NOT NULL,
  126. `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  127. ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  128.  
  129. INSERT INTO `clients_coms` (`client_coms_id`, `client_id`, `coms_id`, `value`, `active`, `main`, `user_id`, `created`) VALUES
  130. (1685, 12516, 1, 'tony@findme.com', 0, 0, 0, '2017-02-27 01:08:26'),
  131. (1685, 12516, 1, 'tony@findmeagain.com', 0, 0, 0, '2017-02-27 01:08:26'),
  132. (1686, 12516, 2, '07081447123', 1, 1, 0, '2017-02-27 01:08:26'),
  133. (1687, 12516, 3, '02081447423', 1, 1, 0, '2017-02-27 01:08:26'),
  134. (1688, 12516, 4, '02081447128', 1, 1, 0, '2017-02-27 01:10:08'),
  135. (1689, 12517, 1, 'trythis@sdfsdfsdf.co.uk', 0, 1, 0, '2017-04-21 08:59:16'),
  136. (1690, 12517, 2, '07702419620', 0, 1, 0, '2017-04-21 08:59:16'),
  137. (1691, 12517, 3, '07702019420', 0, 1, 0, '2017-04-21 08:59:16'),
  138. (1692, 12518, 1, 'teddy.highlander@sdfsdfsdf.com', 1, 1, 0, '2017-04-21 09:37:08'),
  139. (1693, 12518, 2, '07232344566', 1, 1, 0, '2017-04-21 09:37:08'),
  140. (1694, 12518, 3, '02928848888', 1, 1, 0, '2017-04-21 09:37:08'),
  141. (1695, 12519, 1, 'terry.v@sdfsdfsd.com', 1, 1, 0, '2017-04-21 09:42:53'),
  142. (1696, 12519, 2, '07332242323', 1, 1, 0, '2017-04-21 09:42:53'),
  143. (1697, 12519, 3, '02048787656', 1, 1, 0, '2017-04-21 09:42:53'),
  144. (1698, 12519, 4, '02089448776', 1, 1, 0, '2017-04-21 09:46:45'),
  145. (1699, 12520, 1, 'testybanker@sdfsd.com', 1, 1, 0, '2017-04-21 19:17:29'),
  146. (1700, 12520, 2, '07224232345', 1, 1, 0, '2017-04-21 19:17:29'),
  147. (1701, 12520, 3, '02083438383', 1, 1, 0, '2017-04-21 19:17:29'),
  148. (1702, 12520, 4, '02082384282', 1, 1, 0, '2017-04-21 19:19:00'),
  149. (1703, 12516, 1, 'tday@sdfsdfsdfs.co.uk', 1, 1, 18, '2017-04-24 08:57:18'),
  150. (1704, 12521, 1, 'teddy.kruger@sdfsdfsd.com', 1, 1, 0, '2017-05-01 08:23:04'),
  151. (1705, 12521, 2, '07665865665', 1, 1, 0, '2017-05-01 08:23:04'),
  152. (1706, 12521, 3, '02087278888', 1, 1, 0, '2017-05-01 08:23:04'),
  153. (1707, 12521, 4, '02098828722', 1, 1, 0, '2017-05-01 08:24:26'),
  154. (1708, 12522, 1, 'test123@test.com', 1, 1, 0, '2017-05-02 16:51:06'),
  155. (1709, 12522, 2, '07507254489', 1, 1, 0, '2017-05-02 16:51:06'),
  156. (1710, 12522, 3, '07207254489', 1, 1, 0, '2017-05-02 16:51:06'),
  157. (1711, 12522, 4, '01522904210', 1, 1, 0, '2017-05-02 16:55:13'),
  158. (1712, 12523, 1, 'test123@fdgdfg.co.uk', 1, 1, 0, '2017-05-08 09:46:24'),
  159. (1713, 12523, 2, '07494254592', 1, 1, 0, '2017-05-08 09:46:24'),
  160. (1714, 12523, 3, '07494254592', 1, 1, 0, '2017-05-08 09:46:24'),
  161. (1715, 12523, 4, '01980512110', 1, 1, 0, '2017-05-08 09:49:29'),
  162. (1716, 12524, 1, '43201at78285n316xl@undgdfck.co.uk', 1, 1, 0, '2017-05-08 10:09:48'),
  163. (1717, 12524, 2, '07494854590', 1, 1, 0, '2017-05-08 10:09:48'),
  164. (1718, 12524, 3, '01420414510', 1, 1, 0, '2017-05-08 10:09:48'),
  165. (1719, 12524, 4, '07494854592', 1, 1, 0, '2017-05-08 10:13:02'),
  166. (1720, 12525, 1, 'test@test.com', 1, 1, 0, '2017-05-12 10:20:18'),
  167. (1721, 12525, 2, '07343242342', 1, 1, 0, '2017-05-12 10:20:18'),
  168. (1722, 12525, 3, '01731123456', 1, 1, 0, '2017-05-12 10:20:18'),
  169. (1723, 12525, 4, '01734123456', 1, 1, 0, '2017-05-12 10:21:49'),
  170. (1724, 12526, 1, 'terry@terry.com', 1, 1, 0, '2017-05-12 21:51:34'),
  171. (1725, 12526, 2, '07123333333', 1, 1, 0, '2017-05-12 21:51:34'),
  172. (1726, 12526, 3, '03034334343', 1, 1, 0, '2017-05-12 21:51:34'),
  173. (1727, 12527, 1, 'tony@tester.com', 1, 0, 0, '2017-05-12 22:01:57'),
  174. (1728, 12527, 2, '07544444444', 1, 1, 0, '2017-05-12 22:01:57'),
  175. (1729, 12527, 3, '02086767676', 1, 1, 0, '2017-05-12 22:01:57'),
  176. (1730, 12528, 1, 'terry@tester.com', 1, 1, 0, '2017-05-12 22:08:22'),
  177. (1731, 12528, 2, '07332232222', 1, 1, 0, '2017-05-12 22:08:22'),
  178. (1732, 12528, 3, '02098888888', 1, 1, 0, '2017-05-12 22:08:22'),
  179. (1733, 12528, 4, '02089992929', 1, 1, 0, '2017-05-12 22:13:02'),
  180. (1734, 12529, 1, 'info@myemail.com', 1, 1, 0, '2017-05-12 23:14:28'),
  181. (1735, 12529, 2, '07086667656', 1, 1, 0, '2017-05-12 23:14:28'),
  182. (1736, 12529, 3, '02098887878', 1, 1, 0, '2017-05-12 23:14:28'),
  183. (1737, 12529, 4, '02087776767', 1, 1, 0, '2017-05-12 23:15:17'),
  184. (1738, 12530, 1, 'sgmudfgrray@live.co.uk', 1, 1, 0, '2017-05-16 10:05:04'),
  185. (1739, 12530, 2, '07771755011', 1, 1, 0, '2017-05-16 10:05:04'),
  186. (1740, 12530, 3, '01622817656', 1, 1, 0, '2017-05-16 10:05:04'),
  187. (1741, 12530, 4, '02037475718', 1, 1, 0, '2017-05-16 10:07:43'),
  188. (1748, 12533, 1, 'mbudfgper@undfgdk.co.uk', 1, 1, 0, '2017-05-17 10:55:23'),
  189. (1749, 12533, 2, '07000123456', 1, 1, 0, '2017-05-17 10:55:23'),
  190. (1750, 12533, 3, '02030000000', 1, 1, 0, '2017-05-17 10:55:23'),
  191. (1751, 12534, 1, '1@uncdfgdfgck.co.uk', 1, 1, 0, '2017-05-17 15:17:56'),
  192. (1752, 12534, 2, '07000000000', 1, 1, 0, '2017-05-17 15:17:56'),
  193. (1753, 12534, 3, '02000000000', 1, 1, 0, '2017-05-17 15:17:56'),
  194. (1754, 12535, 1, '2@uncldfgdfk.co.uk', 1, 1, 0, '2017-05-17 15:45:02'),
  195. (1755, 12535, 2, '07000000001', 1, 1, 0, '2017-05-17 15:45:02'),
  196. (1756, 12535, 3, '02030000001', 1, 1, 0, '2017-05-17 15:45:02'),
  197. (1757, 12536, 1, 'test@stra890tedfgster.com', 1, 1, 0, '2017-05-24 05:13:46'),
  198. (1758, 12536, 2, '07332232277', 1, 1, 0, '2017-05-24 05:13:46'),
  199. (1759, 12536, 3, '02998879888', 1, 1, 0, '2017-05-24 05:13:46'),
  200. (1760, 12539, 1, 'test@test34324.com', 1, 1, 0, '2017-09-25 07:33:58'),
  201. (1763, 12540, 1, 'test@gmail.com', 1, 1, 0, '2017-10-09 11:20:00'),
  202. (1764, 12540, 2, '07123456789', 1, 1, 0, '2017-10-09 11:20:00'),
  203. (1765, 12540, 3, '01123456789', 1, 1, 0, '2017-10-09 11:20:00'),
  204. (1766, 12540, 4, '01234567895', 1, 1, 0, '2017-10-09 11:31:23'),
  205. (1770, 12540, 1, 'gargruchi12@gmail.com', 0, 0, 30, '2017-10-09 13:07:24'),
  206. (1771, 12542, 1, 'rgupta@uddfgdfgk.com', 1, 1, 0, '2017-10-09 13:09:49'),
  207. (1772, 12542, 2, '07507245489', 1, 1, 0, '2017-10-09 13:09:49'),
  208. (1773, 12542, 3, '01282560110', 1, 1, 0, '2017-10-09 13:09:49'),
  209. (1774, 12542, 4, '01282560110', 1, 1, 0, '2017-10-09 13:11:48'),
  210. (1775, 12542, 4, '01324564564', 1, 1, 0, '2017-10-09 13:14:34'),
  211. (1776, 12527, 1, 'rob@nedgfdfgdls.co.uk', 1, 1, 31, '2017-10-12 09:42:13');
  212.  
  213.  
  214. CREATE TABLE `loans` (
  215. `loan_id` int(11) NOT NULL,
  216. `client_id` int(11) NOT NULL,
  217. `product_id` int(11) NOT NULL DEFAULT '1',
  218. `amount` decimal(7,2) NOT NULL DEFAULT '0.00',
  219. `interest_percent` decimal(7,2) DEFAULT '0.00' COMMENT 'Daily Interest Rate',
  220. `instalments` int(3) DEFAULT NULL,
  221. `fraud_id` int(11) NOT NULL DEFAULT '1',
  222. `code` varchar(4) NOT NULL,
  223. `code_sent` tinyint(1) NOT NULL DEFAULT '0',
  224. `signed` tinyint(1) DEFAULT '0',
  225. `signed_date` date DEFAULT NULL,
  226. `approved_amount` decimal(7,2) NOT NULL DEFAULT '0.00',
  227. `approved_user_id` int(11) DEFAULT NULL,
  228. `rtd` tinyint(1) NOT NULL DEFAULT '0',
  229. `rtd_date` datetime DEFAULT NULL,
  230. `deposited_amount` decimal(7,2) NOT NULL DEFAULT '0.00',
  231. `deposited_date` date DEFAULT NULL,
  232. `depsosited_user_id` int(11) DEFAULT NULL,
  233. `due_date` date DEFAULT NULL,
  234. `assigned_user_id` int(11) DEFAULT '0',
  235. `content_message_id` int(11) DEFAULT NULL,
  236. `balance` decimal(7,2) DEFAULT NULL,
  237. `payout` decimal(7,2) DEFAULT NULL,
  238. `repaid` tinyint(1) NOT NULL DEFAULT '0',
  239. `repaid_date` date DEFAULT NULL,
  240. `writeoff` tinyint(1) NOT NULL DEFAULT '0',
  241. `writeoff_date` date DEFAULT NULL,
  242. `writeoff_user_id` int(11) DEFAULT NULL,
  243. `apr` decimal(10,2) DEFAULT NULL,
  244. `sweep` tinyint(1) NOT NULL DEFAULT '1',
  245. `test` tinyint(1) NOT NULL DEFAULT '0',
  246. `ip` varchar(20) DEFAULT NULL,
  247. `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
  248. ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  249.  
  250. INSERT INTO `loans` (`loan_id`, `client_id`, `product_id`, `amount`, `interest_percent`, `instalments`, `fraud_id`, `code`, `code_sent`, `signed`, `signed_date`, `approved_amount`, `approved_user_id`, `rtd`, `rtd_date`, `deposited_amount`, `deposited_date`, `depsosited_user_id`, `due_date`, `assigned_user_id`, `content_message_id`, `balance`, `payout`, `repaid`, `repaid_date`, `writeoff`, `writeoff_date`, `writeoff_user_id`, `apr`, `sweep`, `test`, `ip`, `created`) VALUES
  251. (9549, 12516, 4, '200.00', '0.80', 6, 1, '7812', 0, 1, '2017-02-27', '200.00', 1, 0, NULL, '200.00', '2017-01-03', 1, NULL, 1, 4, '90.22', '90.22', 0, NULL, 0, NULL, NULL, '1266.04', 1, 0, NULL, '2017-02-27 01:08:26'),
  252. (9550, 12517, 4, '100.00', '0.80', 6, 1, '7521', 0, 0, NULL, '0.00', NULL, 0, NULL, '0.00', NULL, NULL, NULL, 18, NULL, '0.00', NULL, 0, NULL, 0, NULL, NULL, NULL, 1, 0, NULL, '2017-04-21 08:59:16'),
  253. (9551, 12518, 4, '100.00', '0.80', 6, 1, '7146', 0, 0, NULL, '0.00', NULL, 0, NULL, '0.00', NULL, NULL, NULL, 0, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 1, 0, NULL, '2017-04-21 09:37:08'),
  254. (9552, 12519, 4, '100.00', '0.80', 6, 1, '9524', 0, 0, NULL, '0.00', 0, 0, NULL, '0.00', NULL, NULL, NULL, 0, 2, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 1, 0, NULL, '2017-04-21 09:42:53'),
  255. (9553, 12520, 1, '100.00', '0.80', 3, 1, '2597', 0, 0, NULL, '0.00', 0, 0, NULL, '0.00', NULL, NULL, NULL, 0, 2, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 1, 0, NULL, '2017-04-21 19:17:29'),
  256. (9554, 12521, 1, '100.00', '0.80', 3, 1, '8057', 0, 0, NULL, '0.00', 0, 0, NULL, '0.00', NULL, NULL, NULL, 0, 2, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 1, 0, NULL, '2017-05-01 08:23:04'),
  257. (9555, 12516, 4, '200.00', '0.80', 6, 1, '7812', 0, 1, '2017-03-27', '200.00', 1, 0, NULL, '200.00', '2017-02-03', 1, NULL, 1, 4, '508.80', NULL, 0, NULL, 0, NULL, NULL, '1266.04', 1, 0, NULL, '2017-03-27 00:08:26'),
  258. (9556, 12522, 1, '100.00', '0.80', 3, 1, '2976', 0, 0, NULL, '0.00', NULL, 0, NULL, '0.00', NULL, NULL, NULL, 0, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 1, 0, NULL, '2017-05-02 16:51:06'),
  259. (9557, 12523, 1, '100.00', '0.80', 3, 1, '4366', 0, 0, NULL, '0.00', 0, 0, NULL, '0.00', NULL, NULL, NULL, 0, 2, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 1, 0, NULL, '2017-05-08 09:46:24'),
  260. (9558, 12524, 1, '100.00', '0.80', 3, 1, '9040', 0, 0, NULL, '100.00', 18, 0, NULL, '0.00', NULL, NULL, NULL, 0, 2, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 1, 0, NULL, '2017-05-08 10:09:48'),
  261. (9559, 12525, 1, '250.00', '0.80', 3, 1, '4416', 0, 0, NULL, '0.00', 0, 0, NULL, '0.00', NULL, NULL, NULL, 0, 2, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 1, 0, NULL, '2017-05-12 10:20:18'),
  262. (9560, 12526, 1, '175.00', '0.80', 3, 1, '2242', 0, 0, NULL, '0.00', NULL, 0, NULL, '0.00', NULL, NULL, NULL, 0, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 1, 0, NULL, '2017-05-12 21:51:34'),
  263. (9561, 12527, 1, '100.00', '0.80', 3, 1, '2623', 0, 0, NULL, '0.00', NULL, 0, NULL, '0.00', NULL, NULL, NULL, 0, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 1, 0, NULL, '2017-05-12 22:01:57'),
  264. (9562, 12528, 1, '100.00', '0.80', 3, 1, '4932', 1, 1, '2017-05-12', '100.00', 1, 1, '2017-05-13 05:14:06', '0.00', NULL, NULL, NULL, 0, 2, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 1, 0, NULL, '2017-05-12 22:08:22'),
  265. (9563, 12529, 1, '150.00', '0.80', 3, 1, '8136', 0, 0, NULL, '0.00', 0, 0, NULL, '0.00', NULL, NULL, NULL, 0, 2, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 1, 0, NULL, '2017-05-12 23:14:28'),
  266. (9564, 12530, 1, '350.00', '0.80', 3, 1, '2248', 0, 0, NULL, '0.00', 0, 0, NULL, '0.00', NULL, NULL, NULL, 0, 2, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 1, 0, NULL, '2017-05-16 10:05:04'),
  267. (9565, 12536, 1, '200.00', '0.80', 3, 1, '8079', 0, 0, NULL, '0.00', NULL, 0, NULL, '0.00', NULL, NULL, NULL, 0, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 1, 0, NULL, '2017-05-24 05:13:46'),
  268. (9567, 12539, 1, '300.00', '0.80', 3, 1, '8223', 0, 0, NULL, '0.00', NULL, 0, NULL, '0.00', NULL, NULL, NULL, 0, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 1, 0, NULL, '2017-09-25 07:33:58'),
  269. (9568, 12540, 1, '375.00', '0.80', 3, 1, '9123', 0, 0, NULL, '0.00', 0, 0, NULL, '0.00', NULL, NULL, NULL, 0, 2, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 1, 0, NULL, '2017-10-09 11:20:00'),
  270. (9570, 12542, 1, '100.00', '0.80', 3, 1, '4470', 0, 0, NULL, '0.00', NULL, 0, NULL, '0.00', NULL, NULL, NULL, 0, NULL, NULL, NULL, 0, NULL, 0, NULL, NULL, NULL, 1, 0, NULL, '2017-10-09 13:09:49');
  271.  
  272. ALTER TABLE `clients`
  273. ADD PRIMARY KEY (`client_id`),
  274. ADD KEY `fname` (`fname`),
  275. ADD KEY `created` (`created`),
  276. ADD KEY `lname` (`lname`),
  277. ADD KEY `title_id` (`title_id`),
  278. ADD KEY `username` (`username`),
  279. ADD KEY `clientref` (`clientref`),
  280. ADD KEY `dob` (`dob`),
  281. ADD KEY `market_consent` (`market_consent`),
  282. ADD KEY `blacklisted` (`blacklisted`),
  283. ADD KEY `market_broker` (`market_broker`),
  284. ADD KEY `marital_id` (`marital_id`),
  285. ADD KEY `status_difficulty_id` (`status_difficulty_id`);
  286.  
  287. ALTER TABLE `clients_addresses`
  288. ADD PRIMARY KEY (`client_address_id`),
  289. ADD KEY `created` (`created`),
  290. ADD KEY `postcode` (`postcode`),
  291. ADD KEY `client_id` (`client_id`),
  292. ADD KEY `move_in_date` (`movein_date`),
  293. ADD KEY `current` (`current`),
  294. ADD KEY `home_status_id` (`home_status_id`);
  295.  
  296. ALTER TABLE `clients_banks`
  297. ADD PRIMARY KEY (`client_bank_id`),
  298. ADD KEY `created` (`created`),
  299. ADD KEY `sort_code` (`sort_code`),
  300. ADD KEY `bank_id` (`bank_id`),
  301. ADD KEY `client_id` (`client_id`),
  302. ADD KEY `active` (`active`);
  303.  
  304. ALTER TABLE `clients_coms`
  305. ADD PRIMARY KEY (`client_coms_id`),
  306. ADD KEY `client_id` (`client_id`),
  307. ADD KEY `value` (`value`),
  308. ADD KEY `active` (`active`),
  309. ADD KEY `created` (`created`),
  310. ADD KEY `coms_id` (`coms_id`),
  311. ADD KEY `primary_2` (`main`),
  312. ADD KEY `user_id` (`user_id`);
  313.  
  314. ALTER TABLE `loans`
  315. ADD PRIMARY KEY (`loan_id`),
  316. ADD KEY `client_id` (`client_id`),
  317. ADD KEY `product_id` (`product_id`),
  318. ADD KEY `depsoited_user_id` (`depsosited_user_id`),
  319. ADD KEY `deposited_date` (`deposited_date`),
  320. ADD KEY `approved_user_id` (`approved_user_id`),
  321. ADD KEY `deposited_amount` (`deposited_amount`),
  322. ADD KEY `created` (`created`),
  323. ADD KEY `repaid` (`repaid`),
  324. ADD KEY `repaid_date` (`repaid_date`),
  325. ADD KEY `sweep` (`sweep`),
  326. ADD KEY `due_date` (`due_date`),
  327. ADD KEY `ip` (`ip`),
  328. ADD KEY `signed` (`signed`),
  329. ADD KEY `signed_date` (`signed_date`),
  330. ADD KEY `fraud_id` (`fraud_id`),
  331. ADD KEY `assigned_user_id` (`assigned_user_id`),
  332. ADD KEY `code_sent` (`code_sent`),
  333. ADD KEY `test` (`test`),
  334. ADD KEY `content_message_id` (`content_message_id`),
  335. ADD KEY `rtd` (`rtd`),
  336. ADD KEY `rtd_date` (`rtd_date`),
  337. ADD KEY `rtd_2` (`rtd`,`deposited_amount`),
  338. ADD KEY `writeoff` (`writeoff`),
  339. ADD KEY `writeoff_date` (`writeoff_date`),
  340. ADD KEY `payout` (`payout`),
  341. ADD KEY `balance` (`balance`),
  342. ADD KEY `writeoff_user_id` (`writeoff_user_id`);
  343.  
  344.  
  345. ALTER TABLE `clients`
  346. MODIFY `client_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12543;
  347.  
  348. ALTER TABLE `clients_addresses`
  349. MODIFY `client_address_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=605;
  350.  
  351. ALTER TABLE `clients_banks`
  352. MODIFY `client_bank_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=564;
  353.  
  354. ALTER TABLE `clients_coms`
  355. MODIFY `client_coms_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1777;
  356.  
  357. ALTER TABLE `loans`
  358. MODIFY `loan_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9571;
  359.  
  360. ALTER TABLE `clients`
  361. ADD CONSTRAINT `clients_ibfk_2` FOREIGN KEY (`marital_id`) REFERENCES `lkp_marital` (`marital_id`),
  362. ADD CONSTRAINT `clients_ibfk_3` FOREIGN KEY (`status_difficulty_id`) REFERENCES `status_difficulty` (`status_difficulty_id`);
  363.  
  364. ALTER TABLE `clients_addresses`
  365. ADD CONSTRAINT `clients_addresses_ibfk_1` FOREIGN KEY (`client_id`) REFERENCES `clients` (`client_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  366.  
  367. ALTER TABLE `clients_banks`
  368. ADD CONSTRAINT `clients_banks_ibfk_2` FOREIGN KEY (`client_id`) REFERENCES `clients` (`client_id`) ON DELETE CASCADE ON UPDATE CASCADE;
  369.  
  370. ALTER TABLE `clients_coms`
  371. ADD CONSTRAINT `clients_coms_ibfk_1` FOREIGN KEY (`client_id`) REFERENCES `clients` (`client_id`) ON DELETE CASCADE ON UPDATE CASCADE,
  372.  
  373. ALTER TABLE `loans`
  374. ADD CONSTRAINT `loans_ibfk_1` FOREIGN KEY (`client_id`) REFERENCES `clients` (`client_id`) ON DELETE CASCADE ON UPDATE CASCADE,
Add Comment
Please, Sign In to add comment