GalookCZ

merges le tables

Mar 21st, 2021
708
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* MERGE 1 */
  2. CREATE TABLE vr
  3.  
  4.  
  5. SELECT
  6. vr_h.misto_id,
  7. vr_h.misto_nazev,
  8. vr_h.vekova_skupina,
  9. vr_h.povolani,
  10. vr_h.total as h_total,
  11. vr_h.pocet_registrace as h_pocet_registrace,
  12. vr_h.pocet_rezervace as h_pocet_rezervace,
  13. vr_h.pomer_rezervace_total as h_pomer_registrace,
  14. vr_h.average_wait_time as h_wait_time,
  15. vr_w.total as w_total,
  16. vr_w.pocet_registrace as w_pocet_registrace,
  17. vr_w.pocet_rezervace as w_pocet_rezervace,
  18. vr_w.pomer_rezervace_total as w_pomer_registrace,
  19. vr_w.average_wait_time as w_wait_time
  20.  
  21.  
  22. FROM `vr_h`
  23. JOIN vr_w ON vr_w.misto_id = vr_h.misto_id AND vr_h.vekova_skupina = vr_w.vekova_skupina AND vr_w.povolani = vr_h.povolani
  24.  
  25.  
  26.  
  27. /*MERGE 2*/
  28. CREATE TABLE vo
  29.  
  30. SELECT
  31. vo_h.misto_id,
  32. vo_h.misto_nazev,
  33. vo_h.vekova_skupina,
  34. vo_h.total as h_total,
  35. vo_h.pfizer as h_pfizer,
  36. vo_h.moderna as h_moderna,
  37. vo_h.mrna as h_mrna,
  38. vo_h.astrazeneca as h_astrazeneca,
  39. vo_h.astrazeneca / vo_h.total as h_pomer_astrazeneca,
  40.  
  41. vo_w.total as w_total,
  42. vo_w.pfizer as w_pfizer,
  43. vo_w.moderna as w_moderna,
  44. vo_w.mrna as w_mrna,
  45. vo_w.astrazeneca as w_astrazeneca,
  46. vo_w.astrazeneca / vo_w.total as w_pomer_astrazeneca
  47.  
  48.  
  49. FROM `vo_h`
  50. JOIN vo_w ON vo_w.misto_id = vo_h.misto_id AND vo_h.vekova_skupina = vo_w.vekova_skupina
  51.  
  52.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×