.... or MS Query
e.g. (SQL Server):
CREATE PROCEDURE MyStoredProc (@start_date DATETIME, @end_date DATETIME) AS
SELECT RefID, DateEffective, Earnings
FROM EarningsHistory
WHERE DateEffective BETWEEN @start_date AND @end_date
Then this in the SQL window:
EXEC MyStoredProc '01 JAN 2002', '01 JAN 2003'