How can I use a field value in one measurement as a tag value in a different measurement?

Say for example I had saved SNMP data in a fairly unprocessed format with something like
insert snmp,oid=ifName,router=rtrA,index=10 value=‘eth0’
insert snmp,oid=ifInOctets,router=rtrA,index=10 value=1000

and I wanted to process that with a tickscript or CQ to get something like

insert bitrate,router=rtrA,interface=‘eth0’ value=500

Processing the raw octet values into bitrates or whatever is straightforward but how can I use related field values to set tags in the resulting output table? I know for this simple example it can be done by the SNMP plugin in Telegraf but lots of SNMP tables require more complicated mappings to convert an index to a reasonable tag so I’d like to be able to work out a way to do this in TICK or a CQ. Thanks.