hpr-tools/Database/hosts_showcount.sqlite.sql
Dave Morriss fdd0823f93 Finishing off 'query2*' scripts
Database/hosts_list.tpl, Database/hosts_showcount.sqlite.sql: examples
    of using 'query2tt2'

Database/query2csv, Database/query2json, Database/query2tt2: minor bug
    fix relating to '-dbarg=ARG' option
2025-05-09 14:15:41 +01:00

16 lines
558 B
SQL

--
-- Query for use with 'query2tt2' to generate a list of hosts who contributed
-- shows in a particular year. Designed to be used with the 'hosts_list.tpl'
-- template.
-- The two '?' placeholders in the query are to be filled with 'YYYY-01-01'
-- for the start of the year and 'YYYY-12-31'. The values can be passed using
-- the '-dbargs' option to 'query2tt2'.
--
SELECT DISTINCT
printf('%04d',h.hostid) AS hostid, h.host AS hostname
FROM eps e
JOIN hosts h ON e.hostid = h.hostid
WHERE e.date BETWEEN ? AND ?
AND title != 'Reserved'
ORDER BY h.host