MYSQL, How to do SELECT without grouping identical WHERE values?

1

Good Afternoon

SELECT id, descricao FROM Produtos WHERE id IN ('1','1','2', '3','3');

But the result is

id / descricao
1 / Caneta
2 / Lapis
3 / Borracha

I wanted it to look like the table below

id / descricao
1 / Caneta
1 / Caneta
2 / Lapis
3 / Borracha
3 / Borracha
    
asked by anonymous 20.11.2018 / 18:18

1 answer

1

Hello, my friend! I believe you need to use UNION and structure your SELECT as shown below:

MySQL Statement

SELECT id, descricao FROM Produtos WHERE id IN (1) UNION
SELECT id, descricao FROM Produtos WHERE id IN (1)

This will cause the SELECT to be performed individually and unified at run time.

I think this is an alternative. I hope I have helped.
Hugs,

    
25.11.2018 / 03:39