Trying to trim the data in 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 d开发者_JAVA技巧o 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
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
精彩评论