more SQL92 compliance

GREATEST and LEAST are MySQL-isms.

Bug: 877264
Change-Id: Id98d565dd81c8b3c55bbbd3fcd45352c54b85c04
a few fixes for task-durations-by-arch.sql

Made it consistent with other reporting queries in terms of clamping
recipe-task ranges to the reporting range. Removed unneeded YEAR_MONTH
grouped expression. The resulting query doesn't use any MySQL-isms.

Bug: 877272
Change-Id: Ic5b834dd791ac1e3f6c95b9fda96a2788592500d