On Fri, Oct 16, 2009 at 1:42 AM, Michael Chen
<vancouver.mich...@gmail.com> wrote:
> select *, (length(path) - length( replace(path, '/','' )) +1 )

sqlite> SELECT length('/1/2/5/');
7
sqlite> SELECT replace('/1/2/5/', '/', '');
125
sqlite> SELECT length('125');
3

7 - 3 = 4

4 + 1 = 5

sqlite> SELECT (length('/1/2/5/') - length( replace('/1/2/5/', '/','' )) +1 );
5


-- 
Puneet Kishor http://www.punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
-----------------------------------------------------------------------
Assertions are politics; backing up assertions with evidence is science
=======================================================================
Sent from Madison, WI, United States
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to