Cohort Tracking Over Time

I am trying to come up with a query to track a student cohort based on their start term. I want to see if the number of students that started in 2012 actually go down in 4 years time. For this example I am starting with fall 2012 (12/FA). I am closer to where I want to be from where I started. Nevertheless, the results I want should be:

@pixelsoul Thanks for chiming in. It makes sense to use DISTINCT and have no idea why I did not think of that. I will take a closer look at your query, but I have edited my Fiddle (http://sqlfiddle.com/#!2/9ff722/1) with your query and the results are still not what I am looking for. I also found some mistakes I made and corrected it.

There are two students that have a start term of 12/FA, but only one of them actually registered for the 12/FA term (stu_acad_cred records). So, the 12/FA cohort should start with student since only one student registered for a course in 12/FA. I probably need to take a second look at my query and use an INNER JOIN instead of a LEFT JOIN.

Any input is still welcomed. Again, thanks for taking the time look at my issue.

Your latest query is showing 3 for STUDENT COHORT 2012 because student/person 12 is involved in 3 of different groups. I believe what you want is a distinct count of students that are involved, which for 2012 would only be 1, and for 2013 would be 4. Hopefully I am correct about that.

Ok, here is the updated http://sqlfiddle.com/#!2/9ff722/55 which now gives me the correct number of students in a particular cohort. Now, this line a.addDate >= DATE_SUB( CURDATE( ) , INTERVAL 4 YEAR ) in my query is not needed since it is not doing what I hoped.

I want to show the 12/FA cohort over time. Meaning that I want to track this student until he or she graduates based on registrations to see if he or she continues or withdraws at some point. Is it possible to start with 2012 and then have the select query increment/loop step wise (by year or term) for a certain number of years or terms? If so, how?