R
Rick Tipton
I have 2 tables. 1st has 2 fields that will be used to look up in another
table and retrieve a value in a range.
Table 1 fields - Name, Priority, Sales
Table 2 fields - Priority, Range, Contacts
Objective is based on the Priority and Sales from Table 1 will be used to
lookup in Table 2 the Priority and the maximum of Sales Range on Total Sales
should return a Contacts value.
Table 1 Data - Priority - 2, Sales - $200.00
Table 2 Data - Priority - 2, Range - $0, Contacts - 0
Priority - 2, Range - $150, Contacts - 2
Priority - 2, Range - $500, Contacts - 4
Priority - 2, Range - $1000, Contacts - 8
Should return Contacts = 4
I'm getting all rows above the expected value.
SELECT Table 1.Name, Table 1..Priority, Table 1.Sales, Table 2.Priority,
Table 2.Range, Max(Table 2.Range) AS MaxOfRange, Table 2.Contacts
FROM Table 1 INNER JOIN Table 2 ON Table 1.Priority = Table 2.Priority
GROUP BY Table 1.Name, Table 1.Priority, Table 1.Sales, Table 2.Priority,
Table 2.Range, Table 2.Contacts
HAVING (((Max(Table 2.Range))>=[Table 1]![Sales]));
Thank you for looking at this.
table and retrieve a value in a range.
Table 1 fields - Name, Priority, Sales
Table 2 fields - Priority, Range, Contacts
Objective is based on the Priority and Sales from Table 1 will be used to
lookup in Table 2 the Priority and the maximum of Sales Range on Total Sales
should return a Contacts value.
Table 1 Data - Priority - 2, Sales - $200.00
Table 2 Data - Priority - 2, Range - $0, Contacts - 0
Priority - 2, Range - $150, Contacts - 2
Priority - 2, Range - $500, Contacts - 4
Priority - 2, Range - $1000, Contacts - 8
Should return Contacts = 4
I'm getting all rows above the expected value.
SELECT Table 1.Name, Table 1..Priority, Table 1.Sales, Table 2.Priority,
Table 2.Range, Max(Table 2.Range) AS MaxOfRange, Table 2.Contacts
FROM Table 1 INNER JOIN Table 2 ON Table 1.Priority = Table 2.Priority
GROUP BY Table 1.Name, Table 1.Priority, Table 1.Sales, Table 2.Priority,
Table 2.Range, Table 2.Contacts
HAVING (((Max(Table 2.Range))>=[Table 1]![Sales]));
Thank you for looking at this.