Skip to content

Instantly share code, notes, and snippets.

@ankitnetwork18
Created January 11, 2013 11:07
Show Gist options
  • Save ankitnetwork18/4509887 to your computer and use it in GitHub Desktop.
Save ankitnetwork18/4509887 to your computer and use it in GitHub Desktop.
mysql: command to remove all blank spaces from records
UPDATE
accounts_table
INNER JOIN
customers_table ON (accounts_table.user_id = customers_table.user_id)
SET
accountnumber = RTRIM(accountnumber)
WHERE
customers_table.customer_id = 'customer id';
If you do not have many records in accounts_table, and you want to make sure that all the accountnumber values are trimmed, you can simply apply the trim to all the records as follows:
UPDATE
accounts_table
SET
accountnumber = TRIM(accountnumber);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment