SELECT * FROM email_queue WHERE 
		active = 'Active'
		AND
		(
			(resource IS NOT NULL AND resource <> '')
			OR
			(client IS NOT NULL AND client <> '')
		)
		AND
		(sent IS NULL OR sent < '1000-01-01')
		
	