Disk1of3
Disk1of3

Reputation: 1

Access query to pull records that are max of one record but unique of another

I tried adapting sql from here I must be doing something wrong (I know I am because I'm lost when it comes to SQL) Here's my sample table: I want the max ID with unique Trailer

|--ID--|Trailer|--To--|Load Qty A|Load Type/Config A|
|  1   | A100  |  B6  |     2    |        A1        |
|  2   | A100  |  A4  |     1    |        A1        |  <-Show this
|  3   | B099  |  B2  |     6    |        C23       |  <-Show this
|  4   | A027  |  N10 |     3    |        O1        |
|  5   | J400  |  A4  |     8    |        A1        |  <-Show this
|  6   | A027  |  A4  |     4    |        B24       |  <-Show this

I understand this is basically the same structure as the post linked above, but I really cannot get it to work. I thought that I had it working simply by having everything in the query as "last" except for trailer which I had "group by" but it started outputting incorrect records.

Upvotes: 0

Views: 298

Answers (1)

Disk1of3
Disk1of3

Reputation: 1

I figured it out. I created a query for just ID and trailer, set ID to Max and Trailer to GroupBy. Then I created another query with the rest of the fields and simply created a relationship between the ID fields.

Upvotes: 0

Related Questions