0
I have the following tables
boi
-------------------------------
id | peso | data_pesagem |
-------------------------------
1 | 175 | 2019-01-02 |
2 | 200 | 2019-01-03 |
-------------------------------
boi_manejo
---------------------------
fk_boi | peso | data |
---------------------------
1 | 213 | 2019-02-05|
2 | 222 | 2019-02-03|
1 | 213 | 2019-01-20|
2 | 222 | 2019-01-29|
---------------------------
How can I easily search for the date farthest from the ox ID 1 in the handling table, in relation to its weighing date in the first table, for example?
select fk_boi, max( data ) from boi_manejo group by fk_boi
?– Reginaldo Rigo
And if I want to use that function in a Where clause?
– E. Coelho
Thus?
select * from boi_manejo where max( data ) > alguma_data
– Reginaldo Rigo