Advertisement
Guest User

Untitled

a guest
Oct 9th, 2019
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. INSERT INTO cards (`card_number`, `card_status`, `bank_account_id`)
  2. SELECT DISTINCT REVERSE(cs.`full_name`) AS `card_number`,
  3. 'Active' AS `card_status`,
  4. ba.`client_id` AS `bank_account_id`
  5. FROM clients AS cs
  6. JOIN bank_accounts AS ba
  7. ON ba.`client_id` = cs.`id`
  8. JOIN cards AS c
  9. ON c.`bank_account_id` = ba.`id`
  10. WHERE cs.`id` BETWEEN 190 AND 200;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement