How to combine two tables and filter based on one tables field

I am curious to ask. I have two tables one stores logntitude and latitude as floats and another one that stores the device_id as uuid. The thing I want to achieve is write a query which will give me the values longtitude and latitude for a specific device_id as input. How can I combine these two tables, they are stored in the same bucket animal_logs? The measurement is called animal-data and they are inputted at the same time. Any help would be appreciated!

If you want to join two tables then there should be at least one common field in both tables and based on that variable you can combine two tables and store the result in different measurements and after that, you can perform on the new table.

Is it possible to group by _time, also can you provide me with some sample code on how to combine tables and then extract information from them. Thank you!

Here, it’s explained very clearly how to do join two tables