Hello
I am trying to write a query that I need to create a report that will ask the user to input two dates (GIFTDATE) and then list the users (MIDNO) whose gifts (GIFTAMOUNT) in the first year is less than in the second year.
The table gifts has midno (giver ID number), giftamount and giftdate.
This is what I have, but it doesn't work:
SELECT
gifts.midno,
(SELECT d1.giftamount AS date1amt, d1.midno FROM gifts AS d1 WHERE giftdate Like "*"&[date1]&"*"),
(SELECT d2.giftamount AS date2amt, d2.midno FROM gifts AS d2 WHERE giftdate Like "*"&[date2]&"*"),
entities.name
FROM entities, gifts
WHERE
date1amt < date2amt
and d1.midno = d2.midno
Basically, I want to create two columns of giftamounts, one for the first year and one for the second year, and then pick out the ones where the giftamount in the first year is less than the second year.
Any help?
Thanks!!