Sql of note: Difference between revisions
From Federal Burro of Information
Jump to navigationJump to search
(New page: == Example of Time bucket == <pre> select from_unixtime(timestamp-timestamp%3600)as time, count(*) from table where data like 'Destination directory %does not exist at%' and FROM_UNI...) |
No edit summary |
||
Line 13: | Line 13: | ||
order by time; | order by time; | ||
</pre> | </pre> | ||
== sqlite == | |||
.tables | |||
.schema | |||
=== Date / Time === | |||
Last day of this month: | |||
SELECT date('now','start of month','+1 month','-1 day'); | |||
the first day of this monnth: | |||
SELECT date('now','start of month'); | |||
first day of last month: | |||
SELECT date('now','start of month','-1 month'); | |||
last day of last month: | |||
SELECT date('now','start of month','-1 day'); |
Revision as of 16:29, 17 September 2012
Example of Time bucket
select from_unixtime(timestamp-timestamp%3600)as time, count(*) from table where data like 'Destination directory %does not exist at%' and FROM_UNIXTIME(timestamp) > subdate(now(),interval 4 day) group by timestamp-timestamp%3600 order by time;
sqlite
.tables
.schema
Date / Time
Last day of this month:
SELECT date('now','start of month','+1 month','-1 day');
the first day of this monnth:
SELECT date('now','start of month');
first day of last month:
SELECT date('now','start of month','-1 month');
last day of last month:
SELECT date('now','start of month','-1 day');