16 lines
		
	
	
		
			558 B
		
	
	
	
		
			MySQL
		
	
	
	
	
	
		
		
			
		
	
	
			16 lines
		
	
	
		
			558 B
		
	
	
	
		
			MySQL
		
	
	
	
	
	
|   | --
 | ||
|  | -- 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
 |