I have a table with columns a1, a2, a3, etc. to 50. Is it possible to write a sample, where in where the parts without listing all these fields give a search on the array a [1-50] =?
2 answers
NO ... it is impossible to do this in the query ... But you can write a query constructor that is valid according to such an expression will form the corresponding query
$qwery_str = full(1,50); function fuul(int i, int j) { for(int x=i; x<=j;x++) { //тут формирование строки запроса } }
Well, you can still write a list of the names of the fields, but this is your imagination.
If these fields have textual information stored and they are searched for, for example, by LIKE, then, as an option, you can create a full-text index for these fields and use CONTAINS (fields will not have to be listed). If there is no such possibility, then you can make one field in which to put all the data from the columns and look for it. This is the storage and retrieval of textual information.
For the rest, this option comes to mind - if the pillars have the same name and differ only in the number at the end and go in order, then you can make a dynamic query in a loop.