简体   繁体   中英

Access query to retrieve all three fields not equal

I need to write a query in MS Access where all the three columns should not be equal .

For example there are three columns ABC . Each column should not be equal to each other all should have a separate value.

How can I write such a query?

SELECT a, b, c
FROM   my_table
WHERE  a<>b AND a<>c AND b<>c

If your fields are non-nullable, all you need to check is that A != B, A != C, and B != C:

SELECT *
FROM test
WHERE A <> B AND A <> C AND B <> C

The same query would be OK if fields are nullable, but NULL s are not considered a valid value.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM