question

Serge 1 avatar image
Serge 1 asked

Checking for NO Duplicates in multiple columns

Hi all, I have a routing table with ~25 columns Passenger | City1 | City2 |...| City25

Each passenger could have from 1 to 25 cities, but cities have to be unique, so I have to check that passenger does not have the same city twice. Writing few hundreds IF clauses looks like wrong way to do this. Thanks.

sql-server-2005
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Scot Hauder avatar image Scot Hauder commented ·
Normalize your DB before you go any further or every query is going to be convoluted and/or impossible to get the data you want
0 Likes 0 ·

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.