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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:08:43+00:00 2026-05-31T13:08:43+00:00

I am new for sql . It that that any best suited to manage

  • 0

I am new for sql . It that that any best suited to manage and dynamic create hierarchical data in database with efficiently and simply way?
Say for a sample , I am using grid view to view hierarchical data. My grid view need to display like below.

Red             <---Fruit 1
   Apple
   strawberry

Yellow          <-----Fruit 2
   banana
      Papaya

Please assist me how to design database structure in this scenario. On the other hand, how can I perform sorting also. For example:
I change the sequence number becoming

   Yellow          <-----Fruit 2 become Fruit 1
       banana
          Papaya

    Red             <---Fruit 1 become Fruit 2
       Apple
       strawberry

Here is my table(parent and child column)

Parent   Child
null      Red
Red       Apple
Red       Strawberry
null      Yellow
Yellow    banana
banana    papaya

Please guild me some idea and provide me some example. THanks

  • 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-31T13:08:44+00:00Added an answer on May 31, 2026 at 1:08 pm

    Check my answer to a similar post. Solution used a recursive CTE. This solution also involved an id column, and an additional sort key column, which you could add to your source table (or query) for custom sorting.

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

Sidebar

Related Questions

I have a migration that runs an SQL script to create a new Postgres
I need to create an entirely new Sql Server 2008 database and want to
I'm new to Data Mining but not that new to SQL Server. I'm looking
I'm new at LINQ, searching the net for LINQ samples that mimic SQL's LIKE
Question: The new SQL Server 2008 database returns me values formatted English (date/float). Is
I'm loading a SQL Server 2000 database into my new SQL Server 2005 instance
A friend and I are working on a new project that is using SQL
I'm new to T-SQL; all my experience is in a completely different database environment
I have a legacy data table in SQL Server 2005 that has a PK
I am new to database programming and want some tips on performance / best

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.