简体   繁体   中英

Removing blank spaces from the rows

I have a column as name which is having a results like.

name
ABC
XYZ
   ader
fer

I want to remove the blank space before ader and it should print in the output like ader.

How to achieve that?

Depending on your database you can use trim() , ltrim() / rtrim() , or replace() :

select replace(name, ' ', '')
select trim(name, ' ')
select ltrim(rtrim(name))

You can use the LTRIM and RTRIM functions to remove trailing and leading spaces.

SELECT
    RTRIM(LTRIM(name)) AS name
FROM yourTable

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM