i have the following table
table 1
------------------------------------------
| animal_id | animal_name | animal_type |
------------------------------------------
| 1 | kay | cat |
| 2 | sandy | dog |
------------------------------------------
table 2
--------------------------------------------------------------------------
| vaccine_id | animal_id | vaccine_name | vaccine_status | vaccine_date |
--------------------------------------------------------------------------
| 1 | 1 | rabies | done | 2015-09-09 |
| 2 | 1 | chlamydiasis | undone | 2015-09-15 |
| 3 | 1 | parasite | undone | 2015-10-20 |
| 4 | 2 | parasytosis | undone | 2015-11-10 |
| 5 | 2 | rabies | undone | 2015-11-05 |
expected result:
--------------------------------------------------------------------------------------------------------------
| animal_id | animal_name | animal_type | vacccine_id | vaccine_name | vaccine_status | vaccine_date |
--------------------------------------------------------------------------------------------------------------
| 1 | kay | cat | 2 | chlamydiasis | undone | 2015-09-15 |
| 2 | sandy | dog | 5 | rabies | undone | 2015-11-05 |
the result will show all the first row of each unique value between two tables with the most recent vaccine_date and the condition where the vaccine_status is undone. I'm using SQL by the way