Creating a query to find differences (1 Viewer)

biofaku

Member
Local time
Today, 11:51
Joined
May 15, 2020
Messages
66
Hi, I'm trying to create a query that allows me to find the differences between values inside a same table.
Let's suppose I have this table:
ClientItem
A1
A2
A3
B1
B2
B4

The query should return only these results:
ClientItem
A3
B4

I tried using WHERE NOT IN, but so far it did not work.
Any idea how to achieve this?

Thanks!
 

plog

Banishment Pending
Local time
Today, 09:51
Joined
May 11, 2011
Messages
11,648
I don't understand your words, but do understand your example. "Difference" implies subtraction, but that's not what you want based on your example. What you want is to return the highest value in item for each Client. that can be done with a simple aggregate query:


Specifically you want to use the MAX function:


I would read through that entire tutorial.
 

biofaku

Member
Local time
Today, 11:51
Joined
May 15, 2020
Messages
66
Hi plog, thanks for your input. I'm sorry if I have not expressed myself well, and I think the example was confusing because I used numbers on the column Item. What I'm trying to do is a query that gets the values on the column Item that are not in common with the Client column. The value on any of both columns could be a number, a date, a letter.
In this example, both the numbers 1 and 2 are found either on the client A or the client B, but that doesn't happen with the item 3 or the item 4.

I think if EXCEPT on SQL worked on access, the solution would be query using that statement
 

bastanu

AWF VIP
Local time
Today, 07:51
Joined
Apr 13, 2010
Messages
1,402
Please have a look at the attached (query qryDifferencesInItems).
Cheers,
 

Attachments

  • Database91.accdb
    428 KB · Views: 181

plog

Banishment Pending
Local time
Today, 09:51
Joined
May 11, 2011
Messages
11,648
Words aren't working. Please provide sample data to demonstrate what you want.
 

biofaku

Member
Local time
Today, 11:51
Joined
May 15, 2020
Messages
66
Thanks everyone for the input!
bastanu that worked perfectly! Thanks a lot!
 

bastanu

AWF VIP
Local time
Today, 07:51
Joined
Apr 13, 2010
Messages
1,402
You're very welcome, good luck with your project!
Cheers,
 

Users who are viewing this thread

Top Bottom