Doug Reeder <reeder...@gmail.com> wrote: > I need to search for string prefix matches; for example given the path 'PP', > I need to find 'PPA', 'PPBJQ', and 'PPz'. (The character set is all > characters greater than or equal to 'A', and is case-sensitive.) A > statement that does exactly what I want is > > "UPDATE item SET hasChildren = EXISTS (SELECT path FROM item AS c WHERE > substr(c.path, 1, length(item.path)) == item.path AND length(c.path) > > length(item.path)) WHERE path = ? OR path = ?"
Try this: select path from item as c where c.path > item.path and c.path <= item.path || 'z' You can use a large codepoint (say, U+FFFF - it's not a valid Unicode character, but SQLite won't complain) in place of 'z'. -- Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users