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

The Archive Base Latest Questions

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

I have a table where I have menus listed where I can insert and

  • 0

I have a table where I have menus listed where I can insert and delete.

Structure goes like:-

ID  Name                  ParentId
1  1. Home                    0
2  2. Products                0
3      a. SubProduct1         2
4      b. SubProduct2         2
5         i. Subsub           4
6         ii. ......          4
7  3. About                   0

Top-level menu ParentId is always 0 as displayed in 1, 2 and 7.

Child level items would have ParentId of their parent for ex. Subproduct has 2 as its parentId.

When I delete menu item that time all level child item should be delete irrespective of there levels using SQL query.

There can be any number of levels

The levels can go upto subsubsubsub…… any number.

  • 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-12T00:16:05+00:00Added an answer on June 12, 2026 at 12:16 am

    How about this query:

    DECLARE @DelID INT
    SET @DelID=1
    
    ;WITH T(xParent, xChild)AS
    (
    SELECT ParentID, ChildId FROM Table WHERE ParentID=@DelID
    UNION ALL
    SELECT ParentID, ChildId FROM TABLE INNER JOIN T ON ParentID=xChild
    )
    DELETE FROM TABLE WHERE ParentID IN (SELECT xParent FROM T)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table having hierarchical menus like id parent_id name 1 0 menu
I have a table which contains id , name , parentId of Top level
I have a database table menu having id, name and parentid . I have
I have a table that contains multiple dropdown menus for a list of profile
I have three tables menus +--id---ident---+ |--1----menu_1--| menus_data +--id---id_parent---name---------id_lang--+ |--1----1-----------menu_eng------1-------| |--2----1-----------menu_rus------2-------| +--3----1-----------menu_arm------3-------+ languages +--id---name--------+
I need advices for a table structure. I need to create menus dynamically. There
I have two collection_select drop down menus that are currently set up like so:
I have a table with one row and 2 columns. I have two menus
I have one table like this account_id (INT) inviter_id (INT) Now, logged in user
Could you help me: I have three table :there are :users(userid,uername,password,groupid),group(groupid,groupname),menus(menuid,menuname),permissions(menuid,gorupid): I would like

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.