I have a table Folders that has a column called path. I want to get all folders whose path that could be the beginning for “folder1/folder2/folder3/folder4/”.
Acceptable folders would be ones with paths like “folder1/”, “folder1/folder2/” or even “folder1/fold”, I’m not really worried about this last example. An unacceptable answer would be “folder2/”.
Is there a way to make such a query?
Advertisement
Answer
You can use like
:
where 'folder1/folder2/folder3/folder4/' like concat(path, '%')