The behaviour I want to replicate is like grep with -A and -B flags . eg grep -A 2 -B 2 \"hello\" myfile.txt will give me all the lines wh
-A
-B
grep -A 2 -B 2 \"hello\" myfile.txt
Right, this works for me:
SELECT child.* FROM stack as child, (SELECT idstack FROM stack WHERE message LIKE '%hello%') as parent WHERE child.idstack BETWEEN parent.idstack-2 AND parent.idstack+2;