SHARE
TWEET

Untitled

peshopbs2 Dec 8th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. INSERT INTO travel_cards (card_number, job_during_journey, colonist_id, journey_id)
  2.  
  3. SELECT
  4. IF(birth_date>='1980-01-01',
  5. CONCAT(
  6. YEAR(birth_date),
  7. DATE_FORMAT(birth_date, '%d'),
  8. LEFT(ucn, 4)
  9. ),
  10. CONCAT(YEAR(birth_date),
  11. DATE_FORMAT(birth_date, '%m'),
  12. right(ucn, 4)
  13. )
  14. ) AS card_number,
  15. CASE
  16. WHEN id MOD 2 = 0 THEN
  17.     'Pilot'
  18. WHEN id mod 3 = 0 THEN
  19.     'Cook'
  20. ELSE
  21.     'Engineer'
  22. END AS job_during_journey,
  23. id AS colonist_id,
  24. LEFT(ucn, 1) AS journey_id
  25.  FROM colonists
  26. WHERE id BETWEEN 96 AND 100
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top