Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. SELECT dc.URN,dc.GuideName,dc.GuideStreet,ss.categorycalc,pm.initiatedate
  2. FROM dc
  3. LEFT JOIN pm
  4. ON dc.URN = pm.URN
  5. LEFT JOIN ss
  6. ON dc.URN = replace(ss.URN,"/","-")
  7. WHERE dc.GuidePCode LIKE 'WA9%'
  8. ORDER BY pm.Status ASC;
  9.  
  10. EXPLAIN SELECT dc.URN,dc.GuideName,dc.GuideStreet,ss.categorycalc,pm.initiatedate
  11. FROM dc
  12. LEFT JOIN pm ON dc.URN = pm.URN
  13. LEFT JOIN ss ON dc.URN = replace(ss.URN,"/","-")
  14. WHERE dc.GuidePCode LIKE 'WA9%'
  15. ORDER BY pm.Status ASC;
  16.  
  17. ALTER TABLE dc ADD INDEX URNIdx (URN);
  18. ALTER TABLE pm ADD INDEX URNIdx (URN);
  19. ALTER TABLE dc ADD INDEX GuidePCodeIdx (GuidePCode);
  20.  
  21. UPDATE ss SET URNdashed = replace(ss.URN, "/", "-");
  22.  
  23. ALTER TABLE ss ADD INDEX URNdashedIdx (URNdashed);
  24.  
  25. ON dc.URN = replace(ss.URN,"/","-")
  26. to
  27. ON dc.URN = URNdashed
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement