What is the following SQL code trying to do? Please explain
(select
A.RecipientID
B.BeginDate,
B.EndDate,
B.CountyOfResidence,
B.MajorProgram,
B.EligibilityType,
A.Birthdate,
(Case
When ((date'2010-12-31' - dhsviews.RecipientsV.Birthdate ) / 365.25)
<= 21 then 'Ages 0 through 21'
When ((date'2010-12-31' - dhsviews.RecipientsV.Birthdate ) / 365.25)
<= 65 then 'Ages 22 through 65'
When ((date'2010-12-31' - dhsviews.RecipientsV.Birthdate ) / 365.25)
<= 65 then 'Ages 66 and Over'
Else 'error' end_ as Age_Category
from
dhsviews.Recipients V as A,
DHSViews.RecipientElibgibility V as B
Where
A.RecipientID = B.RecipientID
and B.MajorProgram IN ('MA', 'NM', 'IM', 'EH')
and B.EligibilityStatus IN('A', 'C')
and B.BeginDate <= date '2010-12-31'
and B.EndDate >= date '2010-01-01'
Order by 1,2);