sql query: description1, description2, description3, description4, and description 5 can not be the same

I need to return the records where the value is not used in any other description field


if xyz is entered in description1 description 2- 5 cannot have that value.
if xyz is entered in description2 description 1,2,4,5  cannot have that value.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim HornMicrosoft SQL Server Data DudeCommented:
Something like...

SELECT whatever
FROM your_table
   description1 <> description2 AND description2 <> description3 AND 
   description3 <> description4 AND description4 <> description5  

Open in new window

Rey Obrero (Capricorn1)Commented:
if you mean that your table have the fields description1, description2, description3, description4, and description 5, i'll say maybe you need to redesign your table structure.

see this link

why your present table structure is not a good idea
I believe that you must consider null values if they are allowed and you have to compare every field to every other field.

Where d1 & "" <> d2 & "" AND d1 & "" <> d3 & "" AND d1& "" <> d4 & "" AND d1 & "" <> d5 & ""
AND d2 & "" <> d3 & "" AND d2 & "" <> d4 & "" AND d2 & "" <> d5 & ""
AND d3 & "" <> d4 & "" AND d3 & "" <> d5 & ""
AND d4 & "" <> d5 & "";

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
vbnetcoderAuthor Commented:
Rey, For my purpose this is how the table has to be.

PatHartman, I think you are right
vbnetcoderAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.