samedi 25 avril 2015

How to compare multiple table columns with multiple values?


I have a table with N columns like this


column 1 | column 2 | column 3 | ...column N


I have n values like this


value 1 , value 2 , value 3 , ...value n


I wanted to compare these n values with my table's N columns. One way I can do it is:

Select * from table where

column 1 IN (value 1 , value 2 , value 3 , ...value n)
||
column 2 IN (value 1 , value 2 , value 3 , ...value n)
||
column 3 IN (value 1 , value 2 , value 3 , ...value n)
||
.
.
.
column n IN (value1 , value1 , value1 , ...value n)

Is this the most fastest way to do it?


Aucun commentaire:

Enregistrer un commentaire