×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: bejoy balan
Added: Feb 2, 2016 1:55 PM
Views: 9
  1. UPDATE sales_flat_order_address1 SET  `street1` = LEFT(  `street` , LOCATE(  '\n',  `street` ) ) WHERE LOCATE(  '\n',  `street` ) >1
  2.  
  3.  
  4. SELECT * , LOCATE(  '\n',  `street` ) AS a
  5. FROM sales_flat_order_address1
  6. HAVING a >1
  7. LIMIT 0 , 30
  8.  
  9. UPDATE sales_flat_order_address1 SET `street1` = LEFT(`street1`,LOCATE('\n',`street`)-1) WHERE LOCATE('\n',`street`) >1 AND entity_id=598476;
  10.  
  11.  
  12. UPDATE sales_flat_order_address1 SET `street2` = RIGHT(`street`,LENGTH(`street`)-LOCATE('\n',`street`)) WHERE LOCATE('\n',`street`) >1;
  13.  
  14. UPDATE sales_flat_order_address1 SET `street2` = RIGHT(`street`,LENGTH(`street`)-LOCATE('\n',`street`)) WHERE LOCATE('\n',`street`) >1;
  15.  
  16. UPDATE sales_flat_order_address1 SET `street1` = LEFT(`street`,LOCATE('\n',`street`)) WHERE LOCATE('\n',`street`) >1;
  17.  
  18. SELECT entity_id, LENGTH(`street`),RIGHT(`street`,LENGTH(`street`)-LOCATE('\n',`street`)), LOCATE('\n',`street`) as a FROM sales_flat_order_address1 having a>1
  19. SELECT entity_id, LENGTH(`street`),RIGHT(`street`,LENGTH(`street`)-LOCATE('\n',`street`)), LOCATE('\n',`street`) as a FROM sales_flat_order_address1  having a>1
  20.  
  21. UPDATE sales_flat_order_address1 SET `street2` = RIGHT (street, LENGTH(`street`)-LOCATE('\n',`street`));
  22.  
  23.  
  24. SELECT  LEFT(`street`,LENGTH(`street`)-LOCATE('\n',`street`)) FROM sales_flat_order_address1;
  25.