I'm trying to
COUNT records on one table where both the counted records and their "previous" records exist either in the same table or on another.
The table that I'm sampling has a composite
PRIMARY KEY consisting of a
character. The other table has the same structure.
A "previous" record has the same
character and a
bigint - 1 as the counted record either on the same table or on the other table.
counting_table character_column bigint_column other_table character_column bigint_column
counting_table will never have a parallel record on
other_table because the parallel record on
counting_table is deleted when its primary key equivalent is inserted into
I thought I could do this with subqueries, but I can't seem to figure out how to access the outer query's data from inside the subquery.
How can my intent be implemented optimally?