The file that I use ".import" on contains records like this:

 

'2018-03-22 07:01:01'|2533268

 

I had assumed the value was being treated as a datetime, but it looks like it 
may be treated as a string?

Im a bit confused because the column definition sais "datetime", not "varchar", 
so if it's being treated as a string what can I do to fix it to be treated as a 
actual datetime datatype?

 

-----Original Message-----
From: sqlite-users [mailto:[email protected]] On 
Behalf Of Peter Da Silva
Sent: Thursday, March 22, 2018 6:49 AM
To: SQLite mailing list
Subject: Re: [sqlite] How to convert a datetime column to a date?

 

1. It looks like you have superfluous quotes around the dates. That's probably 
your issue.

 

2. Try "select distinct dttm from foo LIMIT 10;"

 

On 3/22/18, 8:47 AM, "sqlite-users on behalf of Ron Watkins" < 
<mailto:[email protected]%20on%20behalf%20of%[email protected]>
 [email protected] on behalf of [email protected]> 
wrote:

    sqlite> select distinct dttm from foo;

    

    …  (lots of records)

    

    '2018-03-22 06:25:01'

    

    '2018-03-22 06:26:01'

    

    '2018-03-22 06:27:01'

    

    '2018-03-22 06:28:01'

    

    '2018-03-22 06:29:01'

    

    '2018-03-22 06:30:01'

    

    '2018-03-22 06:31:01'

    

    '2018-03-22 06:32:02'

    

    '2018-03-22 06:33:01'

    

    '2018-03-22 06:34:01'

    

    '2018-03-22 06:35:01'

    

    '2018-03-22 06:36:01'

    

    '2018-03-22 06:37:01'

    

    '2018-03-22 06:38:01'

    

    '2018-03-22 06:39:01'

    

    '2018-03-22 06:40:01'

    

    '2018-03-22 06:41:01'

    

    '2018-03-22 06:42:01'

    

    '2018-03-22 06:43:01'

    

    '2018-03-22 06:44:01'

    

    sqlite>

    

     

    

    BTW, is there some equilivant to “select top 10 * from foo;” style to 
reduce the number of records? I tried this “top 10” but it’s apparently  not 
supported.

    

     

    

    -----Original Message-----

    From: sqlite-users [ <mailto:[email protected]> 
mailto:[email protected]] On Behalf Of Peter Da Silva

    Sent: Thursday, March 22, 2018 6:33 AM

    To: SQLite mailing list

    Subject: Re: [sqlite] How to convert a datetime column to a date?

    

     

    

    It might be helpful to provide some examples of what you have in those 
DATETIME columns.    

    

     

    

    _______________________________________________

    

    sqlite-users mailing list

    

     < <mailto:[email protected]> 
mailto:[email protected]>  
<mailto:[email protected]> 
[email protected]

    

     < <http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users> 
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users>  
<http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users> 
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

    

    _______________________________________________

    sqlite-users mailing list

     <mailto:[email protected]> 
[email protected]

     <http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users> 
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

    

 

_______________________________________________

sqlite-users mailing list

 <mailto:[email protected]> 
[email protected]

 <http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users> 
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to