Formula and Table Joining in a Query

M

MichaelR

Hi,

I have two tables - one has all of my company sales data with many columns
and the other has a row for each state, rep, product combination. The second
table is just supposed to show which products and in which states each rep is
allowed to sell. So, for example, rep Michael who is allowed to sell products
X, Y, X in NY and NJ, would have six row entries in the table, one for each
possible combination.

I am trying to write a formula (as part of a larger query) that will write
Correct/Incorrect for each sale in the sales data table. If the
rep/state/product combination in the sales table is also in the lookup table
then the formula should return "correct." Otherwise, the formula should
return "incorrect."

I tried to accomplish this by adding a column called Label to the second
table that said "correct" and then left joining the two tables on
rep/state/product. In the query, I wrote, IIF(label<>"",label,"Incorrect).
Although the formula worked, my resulting table had 470,000 rows even though
my actual sales data table only had 340,000. Does anyone have any idea why
this might be happening? Is there an easier way to accomplish what I'm trying
to do?

Thanks,
Michael
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top