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

  • SEARCH
  • Home
  • 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 8733833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:43:40+00:00 2026-06-13T09:43:40+00:00

suppose i have too table folder and file let Folder have two column ID

  • 0

suppose i have too table “folder” and “file”

let Folder have two column ID and FolderID

Folder
------
ID int primary  <-.
FolderId Int    --`

folderId is an internal relationship with Id column of folder table

File table have Two column ID and FolderId

File
-----
Id int primary
FolderID          --->Folder.ID

FolderId is having external relationship with Folder tables’s ID column

**Folder**
Id      FolderId
---     --------
1       NULL
2       1
3       NULL
4       2
5       2

**file**
Id      FolderID
---     ---------
1        2
2        3
3        2
4        4
5        5  

Hope you got the situation,

As we know we can create many folder inside folder and inside folder (Recursive)

Now we want to get list of ALL files (id) which is inside folder id=2 and its Sub Folder (required file id is 3,4,5)

using Recursive function we can get this to work but how to do it more efficient in SQL

  • 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-13T09:43:41+00:00Added an answer on June 13, 2026 at 9:43 am

    Have a look at the answer to this question. Connect By Prior Equivalent for MySQL

    In other databases (such as Oracle) you can use a CONNECT BY in a SQL statement, but it seems that MySQL doesn’t support recursion in selects.

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

Sidebar

Related Questions

I have a table called posts having an INT field posted and a table
Suppose I have a column in a table which may hold information as short
I am working with SQLite. Suppose I have a table sales with two columns,
Suppose I have these two tables: Invoice ------- iInvoiceID int PK not null dtCompleted
Suppose I have one table table1 and another table table2. Both has same column
Suppose I have two web apps to deploy in Tomcat 6, packed as, let
Suppose I have two tables, - emp(empId number(1),empName varchar2(50)) and - manager(manId number(5),managerName varchar2(100))
Suppose I have two h:inputText components. I want to bind both of the text
Suppose I have a MySQL table called MyTable, that looks like this: +----+------+-------+ |
Suppose I have two tables, Customer and Vendor. I want to have a common

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.