SELECT
    RECORDS.FIRST_NAME,
    RECORDS.LAST_NAME,
    GIFT.TYPE,
    GIFT_1.AMOUNT,
    CASE DBO.Query_GetFrequency(GIFT.TYPE,GIFT.ID,GIFT.INSTALLMENT_FREQUENCY)
    WHEN 1 THEN 'Annually' WHEN 2 THEN 'Semi-Annually'
    WHEN 3 THEN 'Quarterly' WHEN 4 THEN 'Bimonthly'
    WHEN 5 THEN 'Monthly' WHEN 6 THEN 'Semi-Monthly'
    WHEN 7 THEN 'Biweekly' WHEN 8 THEN 'Weekly'
    WHEN 9 THEN 'Irregular' WHEN 10 THEN 'Single Installment'
    ELSE '' END "Gift Installment Frequency"

FROM
    RECORDS
    INNER JOIN GIFT ON RECORDS.ID = GIFT.CONSTIT_ID
    INNER JOIN RecurringGiftActivity ON GIFT.ID = RecurringGiftActivity.RecurringGiftId
    INNER JOIN GIFT AS GIFT_1 ON RecurringGiftActivity.PaymentId = GIFT_1.ID

WHERE
    GIFT.TYPE = 30
    AND
    (RecurringGiftActivity.VInstallmentDate BETWEEN '2008-01-01' AND '2008-12-31')