BradEdwards
Technical User
I have a table with Acct #'s and CIF #'s. Some Accts have multiple customers associated with them (ie. Husband and wife). See Example below.
example:
Acct# CIF#
123 CIF01
123 CIF02
345 CIF01
567 CIF03
789 CIF02
789 CIF03
We have an imaging system where we scan in Signature Cards and index them using the CIF #'s (ie scan in signature card and add CIF01 and CIF02 as keywords). I need to write a query to compare ALL the cif #'s on the Signature Cards and add the corresponding Acct #'s. The trick is I can only add an acct # that satisfy's all the CIF #'s on that document. In other words if I have a Sig Card with CIF01 and CIF02 on it even though CIF01 belongs on both Accts 123 and 345 (see above), it would only put Acct 123 on the sig card because all the CIF #'s must match. I can do this with a bunch of joins but the problem is I would have to dynamically build the joins because there can be anywhere from 1 to 10 (or more) people on a sig card. I was hoping there was an easier way to do this. Originally I was creating a temporary table with the following information in it and then doing a bunch of joins with the acct# table.
Temp Table
itemnum CIF#
1 CIF01
1 CIF02
2 CIF01
3 CIF03
4 CIF02
4 CIF03
So Itemnum 1 would have both CIF01 and CIF02 as keywords and acct # 123 would be added as an Acct# keyword (index) and so on. Hopefully all this makes sense. it's a little hard to explain in writing. Any suggestions would be appreciated. Thanks.
example:
Acct# CIF#
123 CIF01
123 CIF02
345 CIF01
567 CIF03
789 CIF02
789 CIF03
We have an imaging system where we scan in Signature Cards and index them using the CIF #'s (ie scan in signature card and add CIF01 and CIF02 as keywords). I need to write a query to compare ALL the cif #'s on the Signature Cards and add the corresponding Acct #'s. The trick is I can only add an acct # that satisfy's all the CIF #'s on that document. In other words if I have a Sig Card with CIF01 and CIF02 on it even though CIF01 belongs on both Accts 123 and 345 (see above), it would only put Acct 123 on the sig card because all the CIF #'s must match. I can do this with a bunch of joins but the problem is I would have to dynamically build the joins because there can be anywhere from 1 to 10 (or more) people on a sig card. I was hoping there was an easier way to do this. Originally I was creating a temporary table with the following information in it and then doing a bunch of joins with the acct# table.
Temp Table
itemnum CIF#
1 CIF01
1 CIF02
2 CIF01
3 CIF03
4 CIF02
4 CIF03
So Itemnum 1 would have both CIF01 and CIF02 as keywords and acct # 123 would be added as an Acct# keyword (index) and so on. Hopefully all this makes sense. it's a little hard to explain in writing. Any suggestions would be appreciated. Thanks.