mysql - How to compare multiple table columns with multiple values? -
i have table n columns this
column 1 | column 2 | column 3 | ...column n
i have n values this
value 1 , value 2 , value 3 , ...value n
i wanted compare these n values table's n columns. 1 way can is:
select * table 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 fastest way it?
in case no.
i suggest change structure of database if it's possible:
table id | column | value_of_column |
date example:
1 | column_1 | zzz 2 | colums_2 | yyyy 3 | colums_1 | yyyy 4 | colums_5 | yyyy ....
and query:
select * table value_of_column in (value......)
Comments
Post a Comment