I'm in need of a purely t-sql script that will average a single integer field across potentially tens of thousands of records. Note the following script:
select stitches from meistergram WHERE rundate BETWEEN '2011-01-01' AND '2011-12-31'
This script identifies the table (meistergram), the integer field (stitches) and qualifies the records to be averaged by a range of dates. Please use this as a basis for adding the additional t-sql required to return just the average of the stitches field. Thanks.