2018-08-29 18:06 GMT+02:00 R Smith <ryansmit...@gmail.com>:

>
> 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
,       Late
,       CAST((Late * 100.0) / Total + .5 AS INTEGER) AS Percentage
FROM    (
    SELECT SUM(total) AS Total
    ,      SUM(late)  AS Late
    FROM  (
        SELECT 1                      AS Total
        ,      (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
>> 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 with:
>>      SELECT COUNT(*) AS Late
>>      FROM   messages
>>      WHERE  date = DATE('now')
>>         AND time NOT LIKE '%:00'
>>
>> Is there a way to get this information in one query?
>>
>
-- 
Cecil Westerhof
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to