Remove everyting before last / slash in mysql
[code lang=”php”]UPDATE `table` SET `column` = SUBSTRING_INDEX(`column`,’/’,-1);[/code] From: AAA/BBB/CCC To: CCC
[code lang=”php”]UPDATE `table` SET `column` = SUBSTRING_INDEX(`column`,’/’,-1);[/code] From: AAA/BBB/CCC To: CCC
Copy one column from one table to another table column – MySql. [code language=”sql”] UPDATE `table` , `table_2` SET table_2.HQ_ID = table.HQ_ID WHERE table_2.name = table.name [/code]
Duplicate id into other column in MySQL. [code language=”sql”] UPDATE contest_cat SET pid = id [/code]
[code language=”sql”] mysqlcheck –auto-repair –check -u username -p dbpassword [/code]
[code language=”php”] $result = mysql_query("SHOW TABLE STATUS LIKE ‘".$table_name."’ "); $row = mysql_fetch_array($result); $next_id = $row[‘Auto_increment’]; [/code]
[code language=”sql”] SELECT city, COUNT(id) AS id FROM YourTable GROUP BY city HAVING COUNT(id) > 3 [/code]