I'm new to sql, and stackoverflow, so please show me mercy. I have 3 tables (described below). I have searched a lot for this specific problem and have not found a solution. I'm a graduate student studying the behavior and psychology of kids as they develop over years. I do this by observing an individual kid's behavior for 10 minutes and recording what they're doing every minute. I do this for multiple kids of different ages, and I follow each kid many times over many years. So the data are mixed-longitudinal (the same individuals are represented by multiple data points over the years). I should also note that I'm currently using Access.
The 10 minute bout is called a "follow," and the activity at each minute is called a "scan." Over the years, I've entered this data into a single Excel sheet with date of follow, timestamp of scan, individual ID, activity, and some other things. I've since broken this up into two tables: a follow_id table, which includes information such as a unique follow ID number, date of each follow, and the ID of the individual followed. I then made a second table with every single scan, and each scan has it's associated follow_id number, which is the unique ID number for the follow that it's from. I hope that makes sense, I tried typing up the tables but I can't get the formatting right. Please forgive my n00bness.
What I need to do is sort out all the scans for, say, infants below 1 year of age, and then between 1-2 years of age, and so on. This has been difficult because nearly all of my subjects are represented in multiple age bins. In other words, I may have followed individual A at 9 months old, then again at 16 months old. So I made a birthday table, which has each individual's ID and their birthdays.
I've tried a bunch of subquerying and joins and whatnot but it's clear that I don't really know what I'm doing. I would really appreciate if someone could point me in the right direction. For instance, should I start with a join? Or could this all work with just subquerying? Any insight would help and be greatly appreciated.
tbl_biography
+------------------------------+
| individual_id | birth_date |
+------------------------------+
| AA | 2016-01-01 |
| BB | 2013-01-01 |
| CC | 2014-01-01 |
+------------------------------+
tbl_follow_id
+-------------------------------------------+
| follow_id | individual_id | follow_date |
+-------------------------------------------+
| 0001 | BB | 2013-12-12 |
| 0002 | BB | 2018-01-01 |
| 0003 | BB | 2015-01-01 |
| 0004 | CC | 2016-01-01 |
| 0005 | AA | 2017-01-01 |
+-------------------------------------------+
tbl_scan_id
-follow_id: 0001; 0001; 0001; 0002; 0002; 0002; 0003; 0003; 0003; 0004; 0004; 0004; 0005; 0005; 0005
-scan_id: 00001; 00002; 00003; 00004; 00005; 00006; 00007; 00008; 00009; 00010; 00011; 00012; 00013; 00014; 00015
-timestamp: (I don’t think this really matters here, but each scan would have hh:mm)
-scan: various behaviors such as REST, PLAY, EAT, etc.
I should point out that you can see that individuals AA and BB are represented in the dataset in 2 separate follows each, and they are different ages for each follow. The question is, how do I filter out, for example, all scans for 0-1 year olds, 1-2 year olds, etc? For now, it would be fine to pool all individuals together. But in the future it would be amazing to be able to do this by certain individuals, say based on sex, mother, and other variables that I also have in the biography table. Thanks everyone in advance.