Hi all, I am storing pages for websites in a 'pages' database table, they are referenced by their path (i.e. 'articles/my-first-blog-post'), I need to select all the children of a particular page, but without selecting grandchildren.
So if I run:
SELECT * FROM pages WHERE path LIKE 'articles%'
I'll get pages with the following paths:
articles/one articles/two articles/two/more articles/three articles/three/more/even-more
I need to filter them (in the query) to just:
articles/one articles/two articles/three
Is there anyway to do something like:
SELECT * FROM pages WHERE path LIKE 'articles%' AND path NOT LIKE 'articles%/%'
Any ideas? Cheers.