Whatever is in your dttm column (there is no datetime type in sqlite) does not 
parse as a valid timestring, so date() returns NULL for each and every row, 
giving just 1 result row.

-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im 
Auftrag von Ron Watkins
Gesendet: Mittwoch, 21. März 2018 16:30
An: sqlite-users@mailinglists.sqlite.org
Betreff: [EXTERNAL] [sqlite] How to convert a datetime column to a date?

I have a table which contains a datetime column:



table|foo|foo|2|CREATE TABLE foo (

        dttm    datetime        not null

        i int             not null

)



I want to select out the max(i) value for each day where there are multiple 
records per day.



select date(dttm) dt,max(i) from foo group by dt order by 1;



However, it’s returning only 1 row, with no date column shown. How can I get an 
actual “date” listed in the first column, and also get 1 row per “date” value.



|5283598256
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___________________________________________
 Gunter Hick | Software Engineer | Scientific Games International GmbH | 
Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 
1 80100 - 0

May be privileged. May be confidential. Please delete if not the addressee.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to