I have a MySQL table where the primary entries are 3 columns: YEAR, NUMBER, and PLOT. Home The column NUMERO is a sequential numbering for each YEAR, however it is possible that for a same number there are several PLOTS. I need to perform a SELECT with arrays, where I have an array for YEAR, another for NUMBER and another for PLOT. The fact is that if you use "IN", it does not have the number associated with YEAR and PLOT. For example:
ANO NUMERO PARCELA
17 5673 1
17 6783 1
18 5673 1
18 6790 1
And I create the following entries $ year = ('17', '18'), $ number = ('5673', '6790') and $ parc = ('1', '1'), following query:
SELECT * FROM table WHERE ANO IN($ano) AND NUM IN($numero) AND PARC IN($parc)
The result will be:
17 -> 5673 -> 1
18 -> 5673 -> 1
18 -> 6790 -> 1
Being that what I want is:
17 -> 5673 -> 1
18 -> 5673 -> 1 <---- SEM ESSE RESULTADO
18 -> 6790 -> 1
That is, I want each entry of the array $ year to be associated with the input of the $ array, associated with the input of the array $ parc.