Tuple of values using mysql procedure

1

I have a form where you have two fields, one service and another value, for each service the user has to put a value, after the user chooses, I consult the bank how many rows will return me with this filter. For the procedure I pass two parameters.

Example of procedure call:
call('1,2,3', '100,200,300')

This is the procedure call, the procedure will receive these two fields and each of these fields is like a array . I want to know how I can make a select where I search for example:

SELECT *
  FROM tabela 
 WHERE codigo = 1
   AND valor = 2
   AND codigo = 2
   AND valor = 20
   AND codigo = 3
   AND valor = 30

But I can not do that, because everything looks like an array, does anyone have an idea?

    
asked by anonymous 29.01.2016 / 19:35

1 answer

1

I do not know if you will be able to query, but try using

WHERE codigo IN(1, 2, 3) and valor IN(2, 20, 30)

But the return would be whatever code and value you're passing.

I think you will have to use a UNION, with as many SELECTs as you need, your example would be 3.

    
29.01.2016 / 20:05