Re: [sqlite] Get data in one query

2018-08-29 Thread Abroży Nieprzełoży
is an implementation detail and > should not be relied upon" > > Is there any way to know what you're getting? Or to explicitly ask for one? > > > -Original Message- > From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On > Behalf Of Keit

Re: [sqlite] Get data in one query

2018-08-29 Thread David Raymond
inglists.sqlite.org] On Behalf Of Keith Medcalf Sent: Wednesday, August 29, 2018 3:45 PM To: SQLite mailing list Subject: Re: [sqlite] Get data in one query ... don't forget that Date('now') returns the UT1 date, not the local (as in Wall Clock/Calendar) date ... date('now', 'localti

Re: [sqlite] Get data in one query

2018-08-29 Thread Cecil Westerhof
2018-08-29 21:44 GMT+02:00 Keith Medcalf : > > ... don't forget that Date('now') returns the UT1 date, not the local (as > in Wall Clock/Calendar) date ... date('now', 'localtime') gives the local > date in accordance with the timezone where your computer thinks it is > located and should always

Re: [sqlite] Get data in one query

2018-08-29 Thread Cecil Westerhof
2018-08-29 21:26 GMT+02:00 Wout Mertens : > By the way, why not store the time as epoch? Date and time in one... > Because I think it is better to have date and time as different (text) fields. -- Cecil Westerhof ___ sqlite-users mailing list

Re: [sqlite] Get data in one query

2018-08-29 Thread Keith Medcalf
m: sqlite-users [mailto:sqlite-users- >boun...@mailinglists.sqlite.org] On Behalf Of Cecil Westerhof >Sent: Wednesday, 29 August, 2018 12:46 >To: SQLite mailing list >Subject: Re: [sqlite] Get data in one query > >2018-08-29 18:58 GMT+02:00 Cecil Westerhof : > >>

Re: [sqlite] Get data in one query

2018-08-29 Thread Wout Mertens
By the way, why not store the time as epoch? Date and time in one... On Wed, Aug 29, 2018, 8:46 PM Cecil Westerhof wrote: > 2018-08-29 18:58 GMT+02:00 Cecil Westerhof : > > > 2018-08-29 18:06 GMT+02:00 R Smith : > > > >> > >> SELECT SUM(Tot) AS Tot, SUM(Late) AS Late > >> FROM (SELECT 1 AS

Re: [sqlite] Get data in one query

2018-08-29 Thread Cecil Westerhof
2018-08-29 18:58 GMT+02:00 Cecil Westerhof : > 2018-08-29 18:06 GMT+02:00 R Smith : > >> >> SELECT SUM(Tot) AS Tot, SUM(Late) AS Late >> FROM (SELECT 1 AS Tot, (time NOT LIKE '%:00') AS Late >> FROM messages >> WHERE date = DATE('now') >>) >> > > Works like a charm.

Re: [sqlite] Get data in one query

2018-08-29 Thread Cecil Westerhof
2018-08-29 18:06 GMT+02:00 R Smith : > > SELECT SUM(Tot) AS Tot, SUM(Late) AS Late > FROM (SELECT 1 AS Tot, (time NOT LIKE '%:00') AS Late > FROM messages > WHERE date = DATE('now') >) > Works like a charm. Thanks. I made it even more useful: SELECT Total ,

Re: [sqlite] Get data in one query

2018-08-29 Thread R Smith
SELECT SUM(Tot) AS Tot, SUM(Late) AS Late   FROM (SELECT 1 AS Tot,  (time NOT LIKE '%:00') AS Late           FROM messages          WHERE date = DATE('now')    ) On 2018/08/29 5:56 PM, Cecil Westerhof wrote: I have a table messages in which something is put every minute. The total

Re: [sqlite] Get data in one query

2018-08-29 Thread Simon Slavin
On 29 Aug 2018, at 4:59pm, Simon Slavin wrote: > You can use this structure: > > SELECT (first SELECT), (second SELECT) Better still in your case, you can use SELECT (first SELECT) as Total, (second SELECT) as Late Simon. ___ sqlite-users

Re: [sqlite] Get data in one query

2018-08-29 Thread Simon Slavin
On 29 Aug 2018, at 4:56pm, Cecil Westerhof wrote: > Is there a way to get this information in one query? You can use this structure: SELECT (first SELECT), (second SELECT) Simon. ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org

[sqlite] Get data in one query

2018-08-29 Thread Cecil Westerhof
I have a table messages in which something is put every minute. The total messages that are added today I can get with: SELECT COUNT(*) AS Total FROM messages WHERE date = DATE('now') And the number of messages that where entered today, but not at the start of a minute I can get