Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 2.33 KB | None | 0 0
  1. SELECT `key`.*,
  2.        `client`.`id`                    AS `client.id`,
  3.        `client`.`f_name`                AS `client.f_name`,
  4.        `client`.`l_name`                AS `client.l_name`,
  5.        `client`.`email`                 AS `client.email`,
  6.        `client`.`phone`                 AS `client.phone`,
  7.        `client`.`note`                  AS `client.note`,
  8.        `client`.`last_login`            AS `client.last_login`,
  9.        `client`.`created_at`            AS `client.createdAt`,
  10.        `client`.`updated_at`            AS `client.updatedAt`,
  11.        `client`.`subscription_id`       AS `client.subscriptionId`,
  12.        `client->subscription`.`id`      AS `client.subscription.id`,
  13.        `client->subscription`.`name`    AS `client.subscription.name`,
  14.        `client->subscription`.`info`    AS `client.subscription.info`,
  15.        `client->subscription`.`key_qty` AS `client.subscription.key_qty`,
  16.        `client->subscription`.`age`     AS `client.subscription.age`,
  17.        `client->accounts`.`id`          AS `client.accounts.id`,
  18.        `client->accounts`.`acc`         AS `client.accounts.acc`,
  19.        `client->accounts`.`acc_type`    AS `client.accounts.acc_type`,
  20.        `client->accounts`.`broker`      AS `client.accounts.broker`,
  21.        `client->accounts`.`balance`     AS `client.accounts.balance`,
  22.        `client->accounts`.`leverage`    AS `client.accounts.leverage`,
  23.        `client->accounts`.`owner_name`  AS `client.accounts.owner_name`,
  24.        `client->accounts`.`lang`        AS `client.accounts.lang`,
  25.        `client->accounts`.`client_id`   AS `client.accounts.clientId`
  26. FROM   (SELECT `key`.`id`,
  27.                `key`.`key`,
  28.                `key`.`exp_date`,
  29.                `key`.`created_at` AS `createdAt`,
  30.                `key`.`updated_at` AS `updatedAt`,
  31.                `key`.`client_id`  AS `clientId`
  32.         FROM   `keys` AS `key`
  33.         WHERE  `key`.`key` = '23423'
  34.         LIMIT  1) AS `key`
  35.        LEFT OUTER JOIN `clients` AS `client`
  36.                     ON `key`.`clientid` = `client`.`id`
  37.        LEFT OUTER JOIN `subscriptions` AS `client->subscription`
  38.                     ON `client`.`subscription_id` = `client->subscription`.`id`
  39.        LEFT OUTER JOIN `accounts` AS `client->accounts`
  40.                     ON `client`.`id` = `client->accounts`.`client_id`;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement