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 6640621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:41:39+00:00 2026-05-25T23:41:39+00:00

Edited outputs: no file names or trailing slashes are included I have a database

  • 0

Edited outputs: no file names or trailing slashes are included

I have a database with potentially thousands thousands of records (we’re talking a 2MB result string if it was just SELECT * FROM xxx in a standard use case.

Now for reasons of security this result cannot be held anywhere for much more processing.

There is a path field where I want to extract all records with each level of folder structure.

So run the query one way I get every record in the root:

C:\

Query again another way I get every record in the first folder level:

C:\a\
C:\b\

etc

Then of course I will GROUP somehow in order to return

C:\a\
C:\b\

and not

C:\a\
C:\a\
C:\b\
C:\b\

hopefully you get the idea?
Any answers that at least move me in the right direction I will be grateful for. I really am stumped where to start with this as downloading every record and processing is far from the ideal solution in my context. (Which is what we do now).

SAMPLE DATA

C:\a\b\c\d
C:\a\b\c
C:\
C:\a\b
C:\g
D:\x
D:\x\y

Sample output 1

C:\
D:\

Sample output 2

C:\a
C:\g
D:\x

sample output 3

C:\a\b
D:\x\y

sample output 4

C:\a\b\c

sample output 5

C:\a\b\c\d
  • 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-05-25T23:41:40+00:00Added an answer on May 25, 2026 at 11:41 pm

    You could do if you have only folders: SELECT DISTINCT path FROM table WHERE LENGTH(path) - LENGTH(replace(path,'\','')) = N

    If you have only file names then it depends on whether you have an INSTR function (or some regexp substitution function) provided by the RDBMS. In all cases, depends on the string functions that are available.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

--edited for clarity (hopefully) I have an XML file that looks something like this:
I have this in my web.config file (edited to reflect some changes): <configSections> <section
I have a console based application which pulls files from a database and outputs
I have a .txt file created in Windows and now should be edited in
Hi i have my text file in this format **4 1250000209852 01 XXXX XXXX
I have a php script that outputs json data. For the purposes of testing,
I have an file uploading site, it has an option of uploading through urls,
I have a Perl script that outputs text. I want to import this text
edited : My file has several lines. I encrypt the file onto a new
I have a database with a row that has TEXTTEXT inside a noteText column

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.