• notice
  • Congratulations on the launch of the Sought Tech site

Mysql section replaces SQL statement sharing

Replace Welcom to in the subject field of the cdb_pms table with Welcome

The code is as follows:

UPDATE `cdb_pms`
SET `subject`=REPLACE(`subject`,'Welcome to','Welcome to')
WHERE INSTR(`subject`,'Welcome to') > 0

Replace the message field of the cdb_posts table, replace "viewthread.php?tid=3989" with "viewthread.php?tid=16546"
code As follows:

UPDATE `cdb_posts`
SET `message`=REPLACE(`message`,'viewthread.php?tid=3989', 'viewthread.php?tid=16546')
WHERE INSTR(`message`,'viewthread.php?tid=3989') > 0;

Remove all spaces
The code is as follows:

UPDATE `es_product` SET `pro_pub_time`=TRIM(`pro_pub_time`)

Delete all characters full of'[' or']' or'.'
The code is as follows:

UPDATE `es_product` SET `pro_pub_time`=REPLACE(`pro_pub_time`,'[','') WHERE INSTR(`pro_pub_time`,'[') > 0
UPDATE `es_product` SET `pro_pub_time`=REPLACE(`pro_pub_time`,']','') WHERE INSTR(`pro_pub_time`,']') > 0
UPDATE `es_product` SET `pro_pub_time`=REPLACE (`pro_pub_time`,'.','-') WHERE INSTR(`pro_pub_time`,'.') > 0

Replace all Chinese'-' with English'-'
The code is as follows:

UPDATE `es_product` SET `pro_pub_time`=REPLACE(`pro_pub_time`, '-','-') WHERE INSTR(`pro_pub_time`,'-') > 0

Replace all years and months with'-'
The code is as follows:

UPDATE `es_product` SET `pro_pub_time`=REPLACE(`pro_pub_time`,'year','-') WHERE INSTR(`pro_pub_time`,'year') > 0
UPDATE `es_product` SET `pro_pub_time`=REPLACE(`pro_pub_time`,'month','-') WHERE INSTR(`pro_pub_time`,'month') > 0

Replace all types of '2005-04-' with '2005-04-01'
The code is as follows:

UPDATE `es_product` SET `pro_pub_time`=CONCAT(`pro_pub_time`, '01') WH ERE SUBSTRING_INDEX(`pro_pub_time`,'-',-1)='' AND LENGTH(`pro_pub_time`) > 0 AND LENGTH(`pro_pub_time`) > 5

Combine all' 2005-'This type is replaced with '2005-01-01'
The code is as follows:

UPDATE `es_product` SET `pro_pub_time`=CONCAT(`pro_pub_time`, '01-01') WHERE INSTR(`pro_pub_time`,'-') > 0 AND LENGTH(`pro_pub_time`)=5

Change all the ones that contain'-' but the number of digits is less than 8 to add'-01'
The code is as follows:

UPDATE `es_product` SET `pro_pub_time`=CONCAT(`pro_pub_time`,'-01') WHERE INSTR(`pro_pub_time`,'-') > 0 AND LENGTH(`pro_pub_time`) < 8

Change all "2005" to "2005-01-01"
The code is as follows:

UPDATE `es_product` SET `pro_pub_time`=CONCAT(`pro_pub_time`,'-01-01') WHERE INSTR(`pro_pub_time`,'-')=0 AND LENGTH(` pro_pub_time`)=4

Finally format all '2005-01-01' into '2005 January'
The code is as follows :

UPDATE `es_product` SET `pro_pub_time`=DATE_FORMAT(`pro_pub_time`,'%Yyear%mmonth') WHERE INSTR(`pro_pub_time `,'-') > 0

Tags

Technical otaku

Sought technology together

Related Topic

24 Comments

author

urenrjrjkvnm

Vikibwn

2023-09-29

author

urenrjrjkvnm

Vikigfg

2023-09-27

author

Ilushikpqt

2023-09-23

author

Cinema

Viktoriqjl

2023-09-23

author

Novost

Margaretbzb

2023-09-23

author

Novost

Margaretlfv

2023-09-22

author

Ilushikipc

2023-09-22

author

Cinema

Viktorisds

2023-09-22

author

Novost

Roblrr

2023-09-20

author

Ilushikzti

2023-09-20

author

coin

Eldarkeu

2023-09-18

author

Julibkv

2023-09-02

author

Life

Veronafix

2023-08-29

author

urenrjrjkvnm

Leonebb

2023-08-28

author

urenrjrjkvnm

Leonomp

2023-08-28

author

Life

Veronawvm

2023-08-27

author

urenrjrjkvnm

Veronacdj

2023-08-26

author

Novost

Sergujb

2023-08-23

author

urenrjrjkvnm

Svetlanabya

2023-08-21

author

Novyny

Svetlgek

2023-08-20

author

Novyny

Svetllpc

2023-08-18

author

Ukraine

Igorfne

2023-08-13

author

Novyny

Svetldip

2023-08-10

author

Novyny

Svetlozj

2023-08-08

Leave a Reply

+