I have a table with several dated snapshots for each user and a table with the latest snapshot date for each user (generated using a query).
I tried several options to get a simple mix of the two, but I had no luck. I want to select all the records from the snapshot table that match the user ID and date from another table.
I have many errors, but this is the last one (subselections and renaming were done for debugging, which field may cause the problem):
SELECT t1.uuid, t1.username, t1.d FROM (SELECT uuid, username, date AS d FROM [Activity.user_snapshots]) as t1 JOIN EACH (SELECT uuid, date AS dg FROM [Activity.latest_snapshots]) as t2 ON t1.uuid = t2.uuid AND t1.d = t2.dg;
The error response that I get in this case is:
Error: Field 'dg' not found in table '__S0'.
When I tried a much more direct request:
SELECT t1.uuid, t1.username, t1.date FROM [Activity.user_snapshots] as t1 JOIN EACH [Activity.latest_snapshots] as t2 ON t1.uuid = t2.uuid AND t1.date = t2.date;
I get this error:
Error: Field date from table __S0 is not a leaf field.
Any ideas?
source share