How can I declare a relationship with a SELECT statement?
I have 2 tables,
I noticed
iot_device and iot_device_status, where the status table saves all current and historical statuses of each device. I like to join the tables together as so:I noticed
relations only take in a pgTable. How can I make it so that it takes the result of the given SQL statement instead?