Query where result equal to any of the values in the list

0

I have a table of Duplicates that has the referring month as string, (ex: 01/2012, 05/2016 and etc)

I need to perform a query between a date range, if the field were DateTime I know that I would just use > = and < = but being a string with month and year, how can I pass a parameter with a list containing the dates I want

select * from(select ID,Duplicata,IF(Modelo ='C','Corretor',if(Modelo = 'S','Supervisor','')) as 'Tipo',(select corr_nome from corretores where corr_id = comissionado) as 'Comissionado', Valor from comissao)A1
 where (select dup_mes from duplicatas dup_mes= /*<LISTA DE VALORES QUE QUERO PESQUISAR>*/

P.S. The List will contain the date range values (01/2017, 02/2017, 03/2017)

    
asked by anonymous 28.04.2017 / 14:21

1 answer

1

You can try to use the IN clause in your SELECT . Ex:

select dup_mes from duplicatas dup_mes IN ('01/2017', '02/2017', '03/2017')
    
28.04.2017 / 15:08