문제

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

For example there are three columns A B C . 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 NULLs are not considered a valid value.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top