My question is how can i speed this up. There should be more elegant way to handle it. The inner select is done in 0,038 sec but this one is done in 6,007 sec i dont know how can i improve this performace
select * FROM table
where number1 in (
SELECT number1
FROM table
WHERE `date` = 'yyyy-mm-dd'
AND value1 = 'variable1'
AND value2 = 1
)
the thing is that i need range of values from the same table if one contains in the value2 the variable 1
so from table like that
id|number1| value1 | value2
1 | 11403 | exempl1 | null
2 | 11404 | exempl1 | 1
3 | 11404 | exempl1 | null
4 | 11405 | exempl1 | null
5 | 11405 | exempl1 | null
i get only this
id|number1| value1 | value2
2 | 11404 | exempl1 | 1
3 | 11404 | exempl1 | null