I'm using MySQL and not really sure where to begin with this. I've got a query which returns
N dates for a given company (
N is likely to be 10 but could be more/less). These dates are returned as such (ddmmyyyy):
SELECT id, dates FROM myTable WHERE id='123'
I'd like to find information from another table that hs similar dates and get values within a boundary. For example, Table2 has
ID, DATE, AGE 123,01012016, 3 123,03012016, 7 123,15012016, 10
I'd like to SUM all Ages between each date brought back by the first command. In this example, the first command boundary would be 01/01/2016 - 13/01/2016 so I'd like to sum all values in the second table that fall between that bounday. This would loop for all date boundaries returned in the first query.
I don't really have a starting point for this type of query in MySQL so any help or pointers in what I should be reading docs for is appreciated