Best Practice for Keeping 'Top Products' Counter Current

Is it possible to modify the query to set set cid = X, where X is a unique identifier so that I can count the number of unique comparisons that are run? The rouble is that there will be Y rows for each comparison, where Y is the count of product in the comparison. So, I can’t simply use an auto-increment.

To rephrase, I’d like all of rows inserted with this query to have the same ID. And then the next time the query runs, I’d like all of THOSE rows to also have the same ID. How is this accomplished?