Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to trim the data in sqlite

Tags:

sqlite

I am trying to trim the data using trim but still it does not trim: it shows new line and space after each line.

Am I doing wrong or is it not possible or do I have to use any other functions? Any help greatly appreciated.

sqlite> select distinct trim(date_start) from test;
    2011-03-22 08:00:00.0
    2011-03-22 09:00:00.0
like image 644
lifemoveson Avatar asked Mar 16 '11 22:03

lifemoveson


1 Answers

Are you sure the characters you're trying to trim are spaces? What you're doing should work:

sqlite> create table test (date_start text);
sqlite> insert into test values ('    2011-03-22 08:00:00.0');
sqlite> insert into test values ('    2011-03-22 09:00:00.0');
sqlite> select * from test;
    2011-03-22 08:00:00.0
    2011-03-22 09:00:00.0
sqlite> select distinct trim(date_start) from test;
2011-03-22 08:00:00.0
2011-03-22 09:00:00.0
like image 168
Nicholas Riley Avatar answered Oct 21 '22 15:10

Nicholas Riley