Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9002725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:36:33+00:00 2026-06-16T00:36:33+00:00

I have a column in my SQLite database that contains a file path. Given

  • 0

I have a column in my SQLite database that contains a file path. Given a portion of the file path, I need to return all the next folders. I would also like to return whether the next portion is the last path in the string (or does not end in a ‘/’). So if I have the folders:

/my/folder/one
/my/folder/two
/my/folder/path/three
/another/path
/one/two/three

And I have the path:

/my/folder/

The result would return something along the lines of:

+----------+------+
| isLast   | item |
+----------+------+
|    1     | one  |
|    1     | two  |
|    0     | path |
+----------+------+

I’ve been struggling with this for a while so if anyone can provide any guidance it would be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:36:34+00:00Added an answer on June 16, 2026 at 12:36 am

    This query:

    SELECT item NOT GLOB '*/*' AS isLast,
           item
    FROM (SELECT substr(MyPath, length('/my/folder/') + 1) AS item
          FROM MyTable
          WHERE MyPath GLOB '/my/folder/' || '*')
    

    will give you a result like this:

    isLast  item
    ------  ----
    1       one
    1       two
    0       path/three
    

    Removing the subpath requires the instr() function, which was only recently introduced in SQLite 3.7.15:

    SELECT isLast,
           CASE WHEN isLast
             THEN item
             ELSE substr(item, 1, instr(item, '/') - 1)
           END AS item
    FROM (SELECT item NOT GLOB '*/*' AS isLast,
                 item
          FROM (SELECT substr(MyPath, length('/my/folder/') + 1) AS item
                FROM MyTable
                WHERE MyPath GLOB '/my/folder/' || '*'))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a description column in my SQLite database that contains some text to
I need to modify a column in a SQLite database but I have to
I'm updating an sqlite database to have a new column bin that is filled
I have a SQLite database in Android with a table that contains longitude, latitude
I have an sqlite database that has a blob column with blob data. I
I have a local sqlite database file that looks something like this… _ID |
I need to query a table in an SQLite database to return all the
I have a database that contains decimals. The column is set up as ..
I have an SQLite3 database that contains several tables. All of these tables include
Greetings All, I have a SQLite database that I'm trying to add a new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.